daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static void main(String[] args) {
  2.         MoveToFrontList list = new MoveToFrontList();
  3.         list.incrementCount("hi");
  4.  
  5.         list.displayAll();
  6.         list.incrementCount("hi");
  7.         list.incrementCount("hi");
  8.         list.incrementCount("hi");
  9.         list.incrementCount("hi");
  10.         list.incrementCount("hi");
  11.  
  12.         list.incrementCount("hello");
  13.         list.incrementCount("hello");
  14.         list.incrementCount("hello");
  15.  
  16.         list.incrementCount("haha");
  17.  
  18.         list.displayAll();
  19.  
  20.         StringCountElement elem1 = new StringCountElement();
  21.         elem1.key = "elem1";
  22.         elem1.count = 3;
  23.  
  24.         StringCountElement elem2 = new StringCountElement();
  25.         elem2.key = "elem2";
  26.         elem2.count = 3;
  27.  
  28.         StringCountElement elem3 = new StringCountElement();
  29.         elem3.key = "elem3";
  30.         elem3.count = 3;
  31.  
  32.         list.spliceIn(elem3, 0);
  33.         list.spliceIn(elem2, list.size());
  34.  
  35.  
  36.         list.displayAll();
  37.  
  38.         list.spliceIn(elem1, 2);
  39.  
  40.         list.spliceOut(elem2);
  41.         list.spliceIn(elem2, 0);
  42.  
  43.         list.displayAll();
  44.  
  45.         System.out.println();
  46.         System.out.println("Test Set 2:");
  47.  
  48.         MoveToFrontList other = new MoveToFrontList();
  49.  
  50.         StringCountElement otherElem1 = new StringCountElement();
  51.         otherElem1.key = "other1";
  52.         otherElem1.count = 1;
  53.  
  54.         StringCountElement otherElem2 = new StringCountElement();
  55.         otherElem2.key = "other2";
  56.         otherElem2.count = 1;
  57.  
  58.         StringCountElement otherElem3 = new StringCountElement();
  59.         otherElem3.key = "other3";
  60.         otherElem3.count = 1;
  61.  
  62.         StringCountElement otherElem4 = new StringCountElement();
  63.         otherElem4.key = "other4";
  64.         otherElem4.count = 1;
  65.  
  66.         other.spliceIn(otherElem1, 0);
  67.         other.spliceIn(otherElem2, 1);
  68.         other.spliceIn(otherElem3, 2);
  69.         other.spliceIn(otherElem4, 2);
  70.         other.displayAll();
  71.  
  72.         other.spliceOut(otherElem3);
  73.         System.out.println("The following value should be null: " + otherElem4.next);
  74.         other.displayAll();
  75.         other.spliceOut(otherElem4);
  76.         System.out.println("The following value should be null: " + otherElem2.next);
  77.         other.displayAll();
  78.         other.spliceOut(otherElem2);
  79.         System.out.println("The following value should be null: " + otherElem1.next);
  80.         other.displayAll();
  81.         other.spliceOut(otherElem1);
  82.         other.displayAll();
  83.         other.spliceOut(otherElem1);
  84.         other.displayAll();
  85.     }
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