Tag: Interview

Java Singleton Cache Example

Problem Given the Java cache interface below, write a singleton class that implements the interface so that no warnings are generated without using @SuppressWarnings annotations //Generic Cache Interface public interface Cache<K, V> { public void put(K key, V value); public V get(K key); } Solution The question is mainly about two points: Type checking warning must be