de.caff.generics

## Class CountingHashSet<T>

- java.lang.Object
- - de.caff.generics.AbstractBasicCountingSet<T>
  - - de.caff.generics.CountingHashSet<T>

- All Implemented Interfaces:
    CountingSet<T>, java.lang.Iterable<T>, java.util.Collection<T>, java.util.Set<T>

      public class CountingHashSet<T>
      extends AbstractBasicCountingSet<T>

  A set which also counts how often any element was added.

  Because it would be breaking the set semantics removal is not allowed. All removal methods but `AbstractBasicCountingSet.clear()` therefore will throw an `UnsupportedOperationException`.

  Author:
    Rammi

- - ### Field Summary

    - ### Fields inherited from class de.caff.generics.AbstractBasicCountingSet

      `creator, map`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CountingHashSet()` Constructor.
    `CountingHashSet(java.util.function.Supplier<Counter> creator)` Constructor.

  - ### Method Summary

    - ### Methods inherited from class de.caff.generics.AbstractBasicCountingSet

      `add, addAll, clear, contains, containsAll, getCount, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Set

      `equals, hashCode, spliterator`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Constructor Detail

    - #### CountingHashSet

          public CountingHashSet(@NotNull
                                 java.util.function.Supplier<Counter> creator)

      Constructor.
      Parameters:
        `creator` - counter creator used for counter creation, see `Counter.SIMPLE` or `Counter.THREAD_SAFE` for standard ones

    - #### CountingHashSet

          public CountingHashSet()

      Constructor. This will use `simple counters`.