public LRUCache(int capacity) {
        this.capacity = capacity;
        size = 0;
        cache = new HashMap<>();
        nodeArr = new Node[capacity];
        nodeCache = new HashMap<>();
        
        /**
         * Using double-linked list to store status of every node in cache:
         * The more closer a node is to <i>tail</i>, the less recently used the <i>node.key</i> is in cache.
         */
        head = new Node(-1);
        tail = new Node(-1);
        head.next = tail;
        tail.prev = head;
        /**
         * Initial all <i>capacity</i> Node. 
         * It improves efficiency when <i>capacity</i> is large and operation of get and set is frequently.
         */
        for (int i = 0; i < capacity; i++) {
            nodeArr[i] = new Node(-1);
        }
    }