2 3 10 26
public void setNth (int loc, T value) { if (loc > numElements -1) throw new QueueUnderflowException(); int i = 0; T hold = null; LLNode<T> curr = front; for (i = 0 ; i < loc ; i++) curr = curr.getLink(); curr.setInfo(value); }
public int compareTo(Printer printer) { int eq = manufact.compareTo(printer.manufact); if (eq != 0) return eq; return model.compareTo(printer.model); }
SortedABList<Printer> printersSorted = new SortedABList<>();
SortedABList<Album> speedSorted = new SortedABList<>(Printer.speedComparator());
public int countAfter(ABList<Printer> prList, Printer printer) { int count = 0; Printer prFromList; Iterator<Printer> prIter = prList.iterator(); while (prIter.hasNext()) { prFromList = prIter.next(); if (prFromList.compareTo(printer) > 0) count++; } return count; }
public void enqueue(T newItem) { elements.add(elements.size(), newItem); }
public T dequeue() { if (elements.size() == 0) throw new QueueUndeflowException(); T item = elements.get(0); elements.remove(0); return item; }
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2023