// Path: src/main/java/io/usethesource/capsule/util/function/ToBooleanBiFunction.java
// @FunctionalInterface
// public interface ToBooleanBiFunction<T, U> {
// 
//   /**
//    * Applies this function to the given two arguments.
//    *
//    * @param t the first function argument
//    * @param u the second function argument
//    * @return the function result
//    */
//   boolean applyAsBoolean(T t, U u);
// }


import java.util.Comparator;
import java.util.Objects;
import io.usethesource.capsule.util.function.ToBooleanBiFunction;
/**
 * Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
 * All rights reserved.
 *
 * This file is licensed under the BSD 2-Clause License, which accompanies this project
 * and is available under https://opensource.org/licenses/BSD-2-Clause.
 */
package io.usethesource.capsule.util;



/*
 * TODO: remove {@link java.io.Serializable} capability after removing comparator from
 * multi-map base classes.
 */
@FunctionalInterface
public interface EqualityComparator<T> extends java.io.Serializable {

  static <T> EqualityComparator<T> fromComparator(Comparator<T> comparator) {
    return (a, b) -> comparator.compare(a, b) == 0;
  }

  static <T> boolean equals(T a, T b,
// Path: src/main/java/io/usethesource/capsule/util/function/ToBooleanBiFunction.java
// @FunctionalInterface
// public interface ToBooleanBiFunction<T, U> {
// 
//   /**
//    * Applies this function to the given two arguments.
//    *
//    * @param t the first function argument
//    * @param u the second function argument
//    * @return the function result
//    */
//   boolean applyAsBoolean(T t, U u);
// }


// Path: src/main/java/io/usethesource/capsule/util/EqualityComparator.java
import java.util.Comparator;
import java.util.Objects;
import io.usethesource.capsule.util.function.ToBooleanBiFunction;

/**
 * Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
 * All rights reserved.
 *
 * This file is licensed under the BSD 2-Clause License, which accompanies this project
 * and is available under https://opensource.org/licenses/BSD-2-Clause.
 */
package io.usethesource.capsule.util;



/*
 * TODO: remove {@link java.io.Serializable} capability after removing comparator from
 * multi-map base classes.
 */
@FunctionalInterface
public interface EqualityComparator<T> extends java.io.Serializable {

  static <T> EqualityComparator<T> fromComparator(Comparator<T> comparator) {
    return (a, b) -> comparator.compare(a, b) == 0;
  }

  static <T> boolean equals(T a, T b,
      ToBooleanBiFunction<T, T> comparator) {