public void addFirst(int data) {
   if (size == capacity) this.remove(tail.data);
   DLLNode temp = new DLLNode(data);
   temp.next = head;
   if (head != null) head.prev = temp;
   else tail = temp;
   head = temp;
   size++;
   hash.put(data, temp);
 }
 public int remove(int data) {
   DLLNode trv = hash.get(data);
   if (trv == null || size <= 0) return -1;
   if (trv == tail) {
     tail = tail.prev;
     tail.next = null;
     trv.prev = null;
   } else if (trv == head) {
     head = head.next;
     head.prev = null;
     trv.next = null;
   } else {
     trv.prev.next = trv.next;
     trv.next.prev = trv.prev;
     trv.next = null;
     trv.prev = null;
   }
   hash.put(trv.data, null);
   size--;
   return trv.data;
 }