@@ -1 +1,986 @@
+public class LRUCache %7B%0A  private class Node %7B%0A    Node prev;%0A    Node next;%0A    int key;%0A    int value;%0A    %0A    public Node(int key, int value) %7B%0A      this.key = key;%0A      this.value = value;%0A      this.prev = null;%0A      this.next = null;%0A    %7D%0A  %7D%0A  %0A  private int capacity;%0A  private HashMap%3CInteger, Node%3E map = new HashMap%3CInteger, Node%3E();%0A  private Node head = new Node(-1, -1);%0A  private Node tail = new Node(-1, -1);%0A  %0A  public LRUCache(int capacity) %7B%0A    this.capacity = capacity;%0A    tail.prev = head;%0A    head.next = tail;%0A  %7D%0A  %0A  public int get(int key) %7B%0A    if (!map.containsKey(key)) %7B%0A      return -1;%0A    %7D%0A    // remove current%0A    Node cur = map.get(key);%0A    cur.prev.next = cur.next;%0A    cur.next.prev = cur.prev;%0A    %0A    // move current to tail%0A    move_to_tail(cur);%0A    %0A    return map.get(key).value;%0A  %7D%0A  %0A  private void move_to_tail(Node cur) %7B%0A    cur.prev = tail.prev;%0A    tail.prev = cur;%0A    cur.prev.next = cur;%0A    cur.next = tail;%0A    %0A  %7D%0A%7D
 %0A

Update LRUCache.java