Code example for ConcurrentMap

Methods: get, putIfAbsent

0
      } 
 
    @SuppressWarnings ("unchecked") 
    public static <T, U extends T> T register (Class<T> klass, U object)
      { 
        singletonMap.putIfAbsent (klass, object);
        return (T) singletonMap.get (klass);
      } 
 
    public static void clear () 
      { 
        singletonMap.clear ();
      } 
 
    public static boolean has (Class<?> name)
      { 
        return singletonMap.containsKey (name);
      } 
  }