spring-framework / org.springframework.util / CollectionUtils / findFirstMatch

findFirstMatch

@Nullable open static fun <E : Any> findFirstMatch(source: MutableCollection<*>, candidates: MutableCollection<E>): E

Return the first element in 'candidates' that is contained in 'source'. If no element in 'candidates' is present in 'source' returns null. Iteration order is Collection implementation specific.

Parameters

source - the source Collection

candidates - the candidates to search for

Return
the first present object, or null if not found