Class HashMultiset<T>

java.lang.Object
org.javimmutable.collections.common.AbstractMultiset<T>
org.javimmutable.collections.hash.HashMultiset<T>
All Implemented Interfaces:
Serializable, Iterable<T>, ICollection<T>, IMultiset<T>, InvariantCheckable, ISet<T>, IStreamable<T>, Mapped<T,T>, SplitableIterable<T>

@Immutable public class HashMultiset<T> extends AbstractMultiset<T> implements Serializable
See Also:
  • Method Details

    • create

      protected IMultiset<T> create(IMap<T,Integer> map, int occurrences)
      Description copied from class: AbstractMultiset
      Implemented by derived classes to create a new instance of the appropriate class.
      Specified by:
      create in class AbstractMultiset<T>
      Parameters:
      map - base map for new multiset
      occurrences - total occurrences in map
      Returns:
      new multiset built from map
    • of

      public static <T> HashMultiset<T> of()
    • deleteAll

      @Nonnull public IMultiset<T> deleteAll()
      Specified by:
      deleteAll in interface ICollection<T>
      Specified by:
      deleteAll in interface IMultiset<T>
      Specified by:
      deleteAll in interface ISet<T>
      Returns:
      an equivalent collection with no values
    • emptyMutableMap

      protected Map<T,Integer> emptyMutableMap()
      Description copied from class: AbstractMultiset
      Implemented by derived classes to create a new empty mutable Map that operates in the same way as this multiset's underlying immutable Map.
      Specified by:
      emptyMutableMap in class AbstractMultiset<T>
      Returns:
      new empty Counter