Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ObjectListTester{
- public static void main (String[] args) {
- ObjectList<String> ol = new ObjectList<>();
- ol.insert("coffee");
- ol.insert("butter");
- ol.insert("milk");
- ol.insert("eggs");
- //insert(); tester
- showList(ol);
- //getCurrent(); tester
- Object current = ol.getCurrent();
- System.out.println("Current node: " + current);
- //getLength(); tester
- System.out.println("Length: " + (ol.getLength()));
- //getNext(); tester
- System.out.println("Next node: " + (ol.getNext()));
- //getPrevious(); tester
- System.out.println("Previous node: " + (ol.getPrevious()));
- //remove(); tester
- //ol.remove();
- //showList(ol);
- //getFirst(); tester
- //Object first = ol.getFirst();
- //System.out.println("First item: " + first);
- //getLast(); tester
- //System.out.println("Last item: " + (ol.getLast()));
- }
- public static void showList(ObjectList<String> ol){
- Object [] contents = ol.toArray();
- for (int i = 0 ; i < contents.length; i++){
- System.out.println(contents[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement