Here you can find the source of comparer(Comparator
public static <T> boolean comparer(Comparator<T> comparator, T object, T... withList)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.Comparator; public class Main { public static <T> boolean comparer(Comparator<T> comparator, T object, T... withList) { return Arrays.stream(withList).noneMatch(with -> comparator.compare(object, with) != 0); } }/*from w w w . j av a2s. c o m*/