any method
Returns true
if at least one element matches the given predicate
.
Returns true
if collection has at least one element when no predicate
is provided
Implementation
bool any([bool Function(T element)? predicate]) {
if (predicate == null) {
if (this is KtCollection) return !(this as KtCollection).isEmpty();
return iterator().hasNext();
}
if (this is KtCollection && (this as KtCollection).isEmpty()) return false;
for (final element in iter) {
if (predicate(element)) return true;
}
return false;
}