Class IdentityCounter<T>

  • Type Parameters:
    T - The type of the objects being counted
    All Implemented Interfaces:
    java.io.Serializable

    public final class IdentityCounter<T>
    extends java.lang.Object
    implements java.io.Serializable

    Purpose-specific set that can tell whether an object (by reference) has already been added to it.

    Objects of this class are not thread-safe.

    Since:
    2.0.0
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.IdentityHashMap<T,​java.lang.Object> counted  
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      IdentityCounter​(int expectedMaxSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void count​(T object)  
      boolean isAlreadyCounted​(T object)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • counted

        private final java.util.IdentityHashMap<T,​java.lang.Object> counted
    • Constructor Detail

      • IdentityCounter

        public IdentityCounter​(int expectedMaxSize)
    • Method Detail

      • count

        public void count​(T object)
      • isAlreadyCounted

        public boolean isAlreadyCounted​(T object)