de.caff.generics

## Interface UniformMatcher<T>

- All Superinterfaces:
    java.util.function.BiPredicate<T,T>, Matcher<T,T>
  All Known Implementing Classes:
    BasicMatcher, ComparableMatcher, ComparatorMatcher, HashCoder, ReferenceMatcher, RevertedUniformMatcher
  Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface UniformMatcher<T>
      extends Matcher<T,T>

  A uniform matcher is a `Matcher` which can only compare objects of the same type.

  Besides `IDENTICAL` which only accepts the same object as identical, useful standard implementations are also `Objects::equals` or `Objects::deepEquals`.

  Author:
    Rammi
  See Also:
    `HashCodeCalculator`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static UniformMatcher<java.lang.Object>` | `IDENTICAL` Uniform matcher which only accepts identical objects.
    `static UniformMatcher<java.lang.Object>` | `NATURAL` Uniform matcher which uses `Object.equals(Object)`.
    `static UniformMatcher<java.lang.Object>` | `NATURAL_NULL_SAFE` Uniform matcher which uses `Objects.deepEquals(Object, Object)`.

  - ### Method Summary

    All Methods Static Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <V> UniformMatcher<V>` | `identical()` Identical matcher.
    `static <V> UniformMatcher<V>` | `natural()` Natural matcher.
    `static <V> UniformMatcher<V>` | `naturalNullSafe()` Natural matcher.

    - ### Methods inherited from interface de.caff.generics.Matcher

      `areEqual, foldLeft, foldRight, test`

    - ### Methods inherited from interface java.util.function.BiPredicate

      `and, negate, or`

- - ### Field Detail

    - #### IDENTICAL

          static final UniformMatcher<java.lang.Object> IDENTICAL

      Uniform matcher which only accepts identical objects. Don't use directly, prefer `identical()`.

    - #### NATURAL

          static final UniformMatcher<java.lang.Object> NATURAL

      Uniform matcher which uses `Object.equals(Object)`. Attention: this is fast but not `null`-safe. Don't use directly, prefer `natural()`.

    - #### NATURAL_NULL_SAFE

          static final UniformMatcher<java.lang.Object> NATURAL_NULL_SAFE

      Uniform matcher which uses `Objects.deepEquals(Object, Object)`. Don't use directly, prefer

  - ### Method Detail

    - #### identical

          @NotNull
          static <V> UniformMatcher<V> identical()

      Identical matcher. This just returns `IDENTICAL` but may be used in cases when the interface does not accept matchers with a super type.
      Type Parameters:
        `V` - value type
      Returns:
        uniform matcher which only accepts identical objects

    - #### natural

          @NotNull
          static <V> UniformMatcher<V> natural()

      Natural matcher. This just returns `NATURAL` but may be used in cases when the interface does not accept matchers with a super type. Attention: this is fast but not `null`-safe.
      Type Parameters:
        `V` - value type
      Returns:
        uniform matcher which only accepts identical objects

    - #### naturalNullSafe

          @NotNull
          static <V> UniformMatcher<V> naturalNullSafe()

      Natural matcher. This just returns `NATURAL_NULL_SAFE` but may be used in cases when the interface does not accept matchers with a super type.
      Type Parameters:
        `V` - value type
      Returns:
        uniform matcher which only accepts identical objects