SHARE
TWEET

Doubly-linked tester

a guest Feb 26th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class ObjectListTester{
  2.     public static void main (String[] args) {
  3.        
  4.         ObjectList<String> ol = new ObjectList<>();
  5.         ol.insert("coffee");
  6.         ol.insert("butter");
  7.         ol.insert("milk");
  8.         ol.insert("eggs");
  9.        
  10.         //insert(); tester
  11.         showList(ol);
  12.         //getCurrent(); tester
  13.         Object current = ol.getCurrent();
  14.         System.out.println("Current node: " + current);
  15.         //getLength(); tester
  16.         System.out.println("Length: " + (ol.getLength()));
  17.         //getNext(); tester
  18.         System.out.println("Next node: " + (ol.getNext()));
  19.         //getPrevious(); tester
  20.         System.out.println("Previous node: " + (ol.getPrevious()));
  21.         //remove(); tester
  22.         //ol.remove();
  23.         //showList(ol);
  24.        
  25.         //getFirst(); tester
  26.         //Object first = ol.getFirst();
  27.         //System.out.println("First item: " + first);
  28.         //getLast(); tester
  29.         //System.out.println("Last item: " + (ol.getLast()));
  30.        
  31.     }
  32.     public static void showList(ObjectList<String> ol){
  33.        
  34.         Object [] contents = ol.toArray();
  35.         for (int i = 0 ; i < contents.length; i++){
  36.             System.out.println(contents[i]);
  37.         }
  38.     }
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top