Class TypedIdentityMap<V>

  • Type Parameters:
    V - value
    All Implemented Interfaces:
    ConcurrentMap<Key<? extends V>,​V>, Map<Key<? extends V>,​V>

    public class TypedIdentityMap<V>
    extends Object
    implements ConcurrentMap<Key<? extends V>,​V>
    A map which maintains its values type safety through a Key instance without having to cast from References inside the map are automatically garbage collected when the reference to Key is lost. See WeakHashMap. Example: TypedIdentityMap<Object> map = new TypedIdentityMap<Object>(); Key<Foo> fooKey = Key.create(Foo.class); map.putIfAbsent(fooKey, new Foo()); Foo foo = map.getValue(fooKey);
    • Constructor Detail

      • TypedIdentityMap

        public TypedIdentityMap()