@Test public void testAddLast() { IntSinglyLinkedList list = new IntSinglyLinkedList(); list.addLast(0); list.addLast(1); assertEquals(0, list.peek()); }
public void addLast(int item) { IntNode n = new IntNode(item); size++; if(tail == null) { head = tail = n; } else { tail.next = n; tail = n; } }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public void addLast(int item) { IntNode n = new IntNode(item); size++; if(tail == null) { head = tail = n; } else { tail.next = n; tail = n; } } }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public void addLast(int item) { IntNode n = new IntNode(item); size++; if(tail == null) { head = tail = n; } else { tail.next = n; tail = n; } } IntSinglyLinkedList(); }
IntSinglyLinkedList implements Serializable, Iterable<Integer> { public void addLast(int item) { IntNode n = new IntNode(item); size++; if(tail == null) { head = tail = n; } else { tail.next = n; tail = n; } } 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 void addLast(int item) { IntNode n = new IntNode(item); size++; if(tail == null) { head = tail = n; } else { tail.next = n; tail = n; } } 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();  }