com.github.rauberprojects.client.Collections Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client-core Show documentation
Show all versions of client-core Show documentation
Reusable core classes for any client implementation.
package com.github.rauberprojects.client;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.Comparator;
/**
* @author Thomas Eizinger
*/
public final class Collections {
private Collections() { }
private static final Logger logger = LoggerFactory.getLogger(Collections.class);
public static boolean contains(Collection collection, T item, Comparator comparator) {
for (T t : collection) {
final int difference = comparator.compare(t, item);
logger.trace("Compared {} against {} using {}: {}", t, item, comparator, difference);
if (difference == 0) {
return true;
}
}
return false;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy