public interface LinkedListInterface { /** * Return the number of items in the linked list * * @return the number of items in the linked list */ int size(); /** * True iff the linked list has 0 items * * @return */ boolean isEmpty(); /** * The "first" item in the linked list. That is the object stored in the first * node. The first node is the item in the linked list which is pointed to by no * other item in the linked list * * @return the object stored in the first node */ J first(); /** * The object stored in the last node of the linked list. Last is the node that * points to no other node. * * @return the object in the last node */ J last(); /** * Add this item to the linked list after the current last item. So after * executing this, a call to last() will return c * * @param c the item to be added */ void addLast(J c); /** * Add the item before the current first item. So after executing this, a call * to first() will return c * * @param c the object to be added. */ void addFirst(J c); /** * Remove the first node from this linked list * * @return the object stored in the first node */ J removeFirst(); /** * Remove the last node from the linked list * * @return the object store in the last node */ J removeLast(); /** * Remove a node containing the provided object. If not found, return false If * found, remove from the linked list the node containing r and return true. * * @param r the object to be removed. * @return true iff the object is in the linked list. */ boolean remove(J r); }