Class CountMap<V>

  • Type Parameters:
    V - the type of the objects

    public class CountMap<V>
    extends java.lang.Object
    Keeps counts of an object
    • Constructor Summary

      Constructors 
      Constructor Description
      CountMap()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(V v)
      Adds a single instance of the give object.
      void add​(V v, java.lang.Integer c)
      Adds multiple instances of the give object.
      void addAll​(CountMap<V> other)
      Add the members of another count map
      java.util.Set<java.util.Map.Entry<V,​java.lang.Integer>> entrySet()
      Get the entry set for the map
      java.lang.Integer get​(V v)
      Get the count of the given object
      java.util.Set<V> keySet()
      Get the set of keys (that is objects)
      java.util.Collection<java.lang.Integer> values()
      Get the set of values (that is counts)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CountMap

        public CountMap()
        Default constructor
    • Method Detail

      • add

        public void add​(V v)
        Adds a single instance of the give object. I.e. increased the count of that object by one.
        Parameters:
        v - The object
      • add

        public void add​(V v,
                        java.lang.Integer c)
        Adds multiple instances of the give object. I.e. increased the count of that object by c.
        Parameters:
        v - The object
        c - The number of instances to add
      • addAll

        public void addAll​(CountMap<V> other)
        Add the members of another count map
        Parameters:
        other - The other count map
      • get

        public java.lang.Integer get​(V v)
        Get the count of the given object
        Parameters:
        v - The object
        Returns:
        The count of that object
      • keySet

        public java.util.Set<V> keySet()
        Get the set of keys (that is objects)
        Returns:
        The set of keys
      • values

        public java.util.Collection<java.lang.Integer> values()
        Get the set of values (that is counts)
        Returns:
        The set of values
      • entrySet

        public java.util.Set<java.util.Map.Entry<V,​java.lang.Integer>> entrySet()
        Get the entry set for the map
        Returns:
        The entry set