title: How to use generics in simple cache implementation with cache interface?
body: <pre><code>public interface Cache&lt;T&gt;{
      public void put(String key,T value);
      public Object get(Object key);
  }
  
  public class CacheImpl&lt;T&gt; implements Cache {
      private static Object monitor = new Object();
      private static CacheImpl instance;
      private Map&lt;String, T&gt; cache = Collections.synchronizedMap(new HashMap&lt;String, T&gt;());
  
  }
  </code></pre>
  
  <p>In the above code I have to use generics for Type Safety Check, but getting error in implemented class.</p>