public int get(int key) {
        if (table.containsKey(key)){
            
            ListNode current = table.get(key);
            ListNode tem = dummy.next;
            
            //handle tail
            if (tail == current){
                tail = current.prev;
            }
            
            current.prev.next = current.next;
            dummy.next = current;
            current.next = tem;
            current.prev = dummy;
            tem.prev = current;
            
            return table.get(key).val;
        } else {
            return -1;
        }
    }