mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 17:29:31 +08:00
@ -168,16 +168,4 @@ public class LRUCache<K, V> {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
final LRUCache<String, Integer> cache = new LRUCache<>(2);
|
||||
cache.put("Key1", 1);
|
||||
cache.put("Key2", 2);
|
||||
cache.put("Key3", 3);
|
||||
cache.put("Key4", 4);
|
||||
System.out.println("getValue(Key1): " + cache.get("Key1"));
|
||||
System.out.println("getValue(Key2): " + cache.get("Key2"));
|
||||
System.out.println("getValue(Key3): " + cache.get("Key3"));
|
||||
System.out.println("getValue(Key4): " + cache.get("Key4"));
|
||||
}
|
||||
}
|
||||
|
@ -166,16 +166,4 @@ public class MRUCache<K, V> {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
final MRUCache<String, Integer> cache = new MRUCache<>(2);
|
||||
cache.put("Key1", 1);
|
||||
cache.put("Key2", 2);
|
||||
cache.put("Key3", 3);
|
||||
cache.put("Key4", 4);
|
||||
System.out.println("getValue(Key1): " + cache.get("Key1"));
|
||||
System.out.println("getValue(Key2): " + cache.get("Key2"));
|
||||
System.out.println("getValue(Key3): " + cache.get("Key3"));
|
||||
System.out.println("getValue(Key4): " + cache.get("Key4"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user