@Test public void peek() { IntSinglyLinkedList list = new IntSinglyLinkedList(); list.enqueue(45); assertEquals(45, list.peek()); assertFalse(list.isEmpty()); }
public int peek() { if(head == null) { throw new NoSuchElementException(); } else { return head.item; } }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public int peek() { if(head == null) { throw new NoSuchElementException(); } else { return head.item; } } }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public int peek() { if(head == null) { throw new NoSuchElementException(); } else { return head.item; } } IntSinglyLinkedList(); }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public int peek() { if(head == null) { throw new NoSuchElementException(); } else { return head.item; } } IntSinglyLinkedList(); int size(); boolean contains(int item); void addLast(int item); void addFirst(int item); boolean isEmpty(); void clear(); int pop(); int peek(); void push(int item); int dequeue(); int getFirst(); void enqueue(int item); int[] toArray(); Integer[] toObjArray(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode(); @Override IntListIterator iterator(); }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public int peek() { if(head == null) { throw new NoSuchElementException(); } else { return head.item; } } IntSinglyLinkedList(); int size(); boolean contains(int item); void addLast(int item); void addFirst(int item); boolean isEmpty(); void clear(); int pop(); int peek(); void push(int item); int dequeue(); int getFirst(); void enqueue(int item); int[] toArray(); Integer[] toObjArray(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode(); @Override IntListIterator iterator();  }