LRUCache<Integer, String> cache = new LRUCache<>(3);

cache.put(1, "A");  // Cache: {1=A}

cache.put(2, "B");  // Cache: {1=A, 2=B}

cache.put(3, "C");  // Cache: {1=A, 2=B, 3=C}

cache.put(4, "D");  // Cache: {2=B, 3=C, 4=D} (1=A removed)

cache.get(2);       // Cache: {3=C, 4=D, 2=B} (2 becomes most recent)

cache.put(5, "E");  // Cache: {4=D, 2=B, 5=E} (3=C removed)