LinkedList - public Object peekTail return reference to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 114 Lab Implement the class definition below: // this class is complete as is. // use it to implement the next class class Link { public Object data; public Link next; public Link(Object d, Link n){data = d, next = n;} } // this class needs to have it's methods implemented class LinkList { private Link head; // reference to first Link private Link tail; // reference to last Link private int size; public LinkList(){} public Object peekHead(){} // return reference to first Object
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public Object peekTail(){} // return reference to last Object public void addHead(Object newData){} public void addTail(Object newData){} public Object removeHead(){} } Write a main program that prints a menu allowing the user to select an operation (such as add to head of list) and then do the operation on the LinkedList. Use Strings as he Objects to be stored in the list....
View Full Document

Ask a homework question - tutors are online