de.caff.generics

## Class IdentityHashSet<T>

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractSet<T>
    - - de.caff.generics.IdentityHashSet<T>

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

      public class IdentityHashSet<T>
      extends java.util.AbstractSet<T>

  Hash set based on identities. Although useful, this is missing in the Java standard library.
  Since:
    May 13, 2025
  Author:
    Rammi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IdentityHashSet()` Default constructor.
    `IdentityHashSet(java.util.Collection<? extends T> collection)` Copy constructor.
    `IdentityHashSet(Countable<? extends T> countable)` Copy constructor.
    `IdentityHashSet(int initialCapacity)` Constructor.
    `IdentityHashSet(java.lang.Iterable<? extends T> iterable)` Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(T t)`
    `boolean` | `addAll(java.util.Collection<? extends T> c)`
    `void` | `clear()`
    `boolean` | `contains(java.lang.Object o)`
    `boolean` | `containsAll(java.util.Collection<?> c)`
    `void` | `forEach(java.util.function.Consumer<? super T> action)`
    `boolean` | `isEmpty()`
    `java.util.Iterator<T>` | `iterator()`
    `java.util.stream.Stream<T>` | `parallelStream()`
    `boolean` | `remove(java.lang.Object o)`
    `boolean` | `removeAll(java.util.Collection<?> c)`
    `boolean` | `removeIf(java.util.function.Predicate<? super T> filter)`
    `int` | `size()`
    `java.util.Spliterator<T>` | `spliterator()`
    `java.util.stream.Stream<T>` | `stream()`
    `java.lang.Object[]` | `toArray()`
    `<T1> T1[]` | `toArray(T1[] a)`

    - ### Methods inherited from class java.util.AbstractSet

      `equals, hashCode`

    - ### Methods inherited from class java.util.AbstractCollection

      `retainAll, toString`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

      `retainAll`

- - ### Constructor Detail

    - #### IdentityHashSet

          public IdentityHashSet()

      Default constructor.

    - #### IdentityHashSet

          public IdentityHashSet(int initialCapacity)

      Constructor.
      Parameters:
        `initialCapacity` - initial capacity of this set

    - #### IdentityHashSet

          public IdentityHashSet(@NotNull
                                 java.lang.Iterable<? extends T> iterable)

      Copy constructor. This copies the values of the `iterable` to this set.
      Parameters:
        `iterable` - iterable providing the initial values

    - #### IdentityHashSet

          public IdentityHashSet(@NotNull
                                 java.util.Collection<? extends T> collection)

      Copy constructor. This copies the values of the `collection` to this set.
      Parameters:
        `collection` - collection providing the initial values

    - #### IdentityHashSet

          public IdentityHashSet(@NotNull
                                 Countable<? extends T> countable)

      Copy constructor. This copies the values of the `countable` to this set.
      Parameters:
        `countable` - countable providing the initial values

  - ### Method Detail

    - #### iterator

          @NotNull
          public java.util.Iterator<T> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<T>`
      Specified by:
        `iterator` in interface `java.util.Collection<T>`
      Specified by:
        `iterator` in interface `java.util.Set<T>`
      Specified by:
        `iterator` in class `java.util.AbstractCollection<T>`

    - #### size

          public int size()

      Specified by:
        `size` in interface `java.util.Collection<T>`
      Specified by:
        `size` in interface `java.util.Set<T>`
      Specified by:
        `size` in class `java.util.AbstractCollection<T>`

    - #### spliterator

          @NotNull
          public java.util.Spliterator<T> spliterator()

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `java.util.Collection<T>`
      Specified by:
        `isEmpty` in interface `java.util.Set<T>`
      Overrides:
        `isEmpty` in class `java.util.AbstractCollection<T>`

    - #### removeAll

          public boolean removeAll(@NotNull
                                   java.util.Collection<?> c)

      Specified by:
        `removeAll` in interface `java.util.Collection<T>`
      Specified by:
        `removeAll` in interface `java.util.Set<T>`
      Overrides:
        `removeAll` in class `java.util.AbstractSet<T>`

    - #### contains

          public boolean contains(java.lang.Object o)

      Specified by:
        `contains` in interface `java.util.Collection<T>`
      Specified by:
        `contains` in interface `java.util.Set<T>`
      Overrides:
        `contains` in class `java.util.AbstractCollection<T>`

    - #### toArray

          @NotNull
          public java.lang.Object[] toArray()

      Specified by:
        `toArray` in interface `java.util.Collection<T>`
      Specified by:
        `toArray` in interface `java.util.Set<T>`
      Overrides:
        `toArray` in class `java.util.AbstractCollection<T>`

    - #### toArray

          @NotNull
          public <T1> T1[] toArray(@NotNull
                                            T1[] a)

      Specified by:
        `toArray` in interface `java.util.Collection<T>`
      Specified by:
        `toArray` in interface `java.util.Set<T>`
      Overrides:
        `toArray` in class `java.util.AbstractCollection<T>`

    - #### add

          public boolean add(T t)

      Specified by:
        `add` in interface `java.util.Collection<T>`
      Specified by:
        `add` in interface `java.util.Set<T>`
      Overrides:
        `add` in class `java.util.AbstractCollection<T>`

    - #### remove

          public boolean remove(java.lang.Object o)

      Specified by:
        `remove` in interface `java.util.Collection<T>`
      Specified by:
        `remove` in interface `java.util.Set<T>`
      Overrides:
        `remove` in class `java.util.AbstractCollection<T>`

    - #### containsAll

          public boolean containsAll(@NotNull
                                     java.util.Collection<?> c)

      Specified by:
        `containsAll` in interface `java.util.Collection<T>`
      Specified by:
        `containsAll` in interface `java.util.Set<T>`
      Overrides:
        `containsAll` in class `java.util.AbstractCollection<T>`

    - #### addAll

          public boolean addAll(@NotNull
                                java.util.Collection<? extends T> c)

      Specified by:
        `addAll` in interface `java.util.Collection<T>`
      Specified by:
        `addAll` in interface `java.util.Set<T>`
      Overrides:
        `addAll` in class `java.util.AbstractCollection<T>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `java.util.Collection<T>`
      Specified by:
        `clear` in interface `java.util.Set<T>`
      Overrides:
        `clear` in class `java.util.AbstractCollection<T>`

    - #### removeIf

          public boolean removeIf(@NotNull
                                  java.util.function.Predicate<? super T> filter)

    - #### stream

          @NotNull
          public java.util.stream.Stream<T> stream()

    - #### parallelStream

          @NotNull
          public java.util.stream.Stream<T> parallelStream()

    - #### forEach

          public void forEach(java.util.function.Consumer<? super T> action)