Class TinyIdentitySet<E>

  • Type Parameters:
    E - the type contained in the Set
    All Implemented Interfaces:
    Iterable<E>, Collection<E>, Set<E>

    public final class TinyIdentitySet<E>
    extends Object
    implements Set<E>
    A Set implementation which only considers object identity. It should only be used for small number of objects, as it is implemented as scanning an ArrayList for identity matches. In other words: Performance will only be acceptable for small sets. The rationale for this class is the high cost of the object identifier used in IdentityHashMap, where the key set is often used as an identity set.
    Author:
    Steinar Knutsen
    See Also:
    IdentityHashMap
    • Constructor Detail

      • TinyIdentitySet

        public TinyIdentitySet​(int initSize)
        Create a set with an initial capacity of initSize. The internal array will grow automatically with a linear growth rate if more elements than initSize are added.
        Parameters:
        initSize - initial size of internal element array