Polish containsAny of CollectionUtils by reusing findFirstMatch
This commit is contained in:
@@ -181,15 +181,7 @@ public abstract class CollectionUtils {
|
||||
* @return whether any of the candidates has been found
|
||||
*/
|
||||
public static boolean containsAny(Collection<?> source, Collection<?> candidates) {
|
||||
if (isEmpty(source) || isEmpty(candidates)) {
|
||||
return false;
|
||||
}
|
||||
for (Object candidate : candidates) {
|
||||
if (source.contains(candidate)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return findFirstMatch(source, candidates) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user