de.caff.generics.matcher

## Class ComparatorMatcher<T>

- java.lang.Object
- - de.caff.generics.matcher.ComparatorMatcher<T>

- All Implemented Interfaces:
    Matcher<T,T>, UniformMatcher<T>, java.util.function.BiPredicate<T,T>

      public class ComparatorMatcher<T>
      extends java.lang.Object
      implements UniformMatcher<T>

  A matcher which uses a comparator for equality checking.

  Objects are considered equal if the comparator returns `0`.

  How this matcher handles `null` values depends on the comparator.

  Author:
    Rammi
  See Also:
    `Match.from(java.util.Comparator)`

- - ### Field Summary

    - ### Fields inherited from interface de.caff.generics.UniformMatcher

      `IDENTICAL, NATURAL, NATURAL_NULL_SAFE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ComparatorMatcher(java.util.Comparator<T> comparator)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `areEqual(T object1, T object2)` Are the given two objects considered equal?

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

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

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

      `identical, natural, naturalNullSafe`

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

      `foldLeft, foldRight, test`

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

      `and, negate, or`

- - ### Constructor Detail

    - #### ComparatorMatcher

          public ComparatorMatcher(java.util.Comparator<T> comparator)

      Constructor.
      Parameters:
        `comparator` - comparator

  - ### Method Detail

    - #### areEqual

          public boolean areEqual(T object1,
                                  T object2)

      Are the given two objects considered equal?
      Specified by:
        `areEqual` in interface `Matcher<T,T>`
      Parameters:
        `object1` - object 1
        `object2` - object 2
      Returns:
        `true` if this matcher considers the two object equals
        `false` if this matcher considers them different