Class DelegatingMultiset<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<T,​java.lang.Long> map  
      private static long serialVersionUID  
      private long size  
    • Constructor Summary

      Constructors 
      Constructor Description
      DelegatingMultiset​(java.util.Map<T,​java.lang.Long> map)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(T element)
      Add the element to the multiset
      void add​(T element, long add)
      Add the element to the multiset
      long count​(T element)
      Count the elements in multiset
      java.util.Collection<java.util.Map.Entry<T,​java.lang.Long>> entrySet()
      Get all associations of the multiset.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      boolean isEmpty()
      Answers if Multiset is empty
      java.util.Collection<T> keys()
      Answers the collection of keys
      long size()
      Answers the size of multiset.
      • Methods inherited from class java.lang.Object

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

      • map

        protected final java.util.Map<T,​java.lang.Long> map
      • size

        private long size
    • Constructor Detail

      • DelegatingMultiset

        public DelegatingMultiset​(java.util.Map<T,​java.lang.Long> map)
    • Method Detail

      • add

        public void add​(T element)
        Description copied from interface: Multiset
        Add the element to the multiset
        Specified by:
        add in interface Multiset<T>
        Parameters:
        element - element to add
      • add

        public void add​(T element,
                        long add)
        Description copied from interface: Multiset
        Add the element to the multiset
        Specified by:
        add in interface Multiset<T>
        Parameters:
        element - element to add
        add - number of elements to add
      • count

        public long count​(T element)
        Description copied from interface: Multiset
        Count the elements in multiset
        Specified by:
        count in interface Multiset<T>
        Parameters:
        element - element
        Returns:
        number of matching elements in the set; zero, if no elements
      • entrySet

        public java.util.Collection<java.util.Map.Entry<T,​java.lang.Long>> entrySet()
        Description copied from interface: Multiset
        Get all associations of the multiset. Each entry provides a key and a count of that element.
        Specified by:
        entrySet in interface Multiset<T>
        Returns:
        entry set of the multiset
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Multiset
        Answers if Multiset is empty
        Specified by:
        isEmpty in interface Multiset<T>
        Returns:
        true, if set is empty
      • size

        public long size()
        Description copied from interface: Multiset
        Answers the size of multiset. Equivalent to number of elements, counting duplications.
        Specified by:
        size in interface Multiset<T>
        Returns:
        number of elements
      • keys

        public java.util.Collection<T> keys()
        Description copied from interface: Multiset
        Answers the collection of keys
        Specified by:
        keys in interface Multiset<T>
        Returns:
        the collections of keys
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object