public void insertLast(ListNode x) {
   if (front == null) {
     front = back = x;
     size++;
   } else {
     front.setNext(x);
     front = x;
     size++;
   }
 }
 public void insertFirst(ListNode x) {
   if (back == null) {
     front = back = temp = x;
     size++;
   } else {
     x.setNext(back);
     back = x;
     size++;
   }
 }