

If any the elements of list matches the predicate, we should get true as return value from any().

Returns true if at least one element matches the given predicate. Syntax 2 fun Iterable.any(predicate: (T) -> Boolean): Boolean List It is an ordered collection in which we can access elements or items by using indices integer numbers that define a position for each element. Indices start from zero the index of the first element and go to. Returns true if collection has at least one element. Kotlin List stores elements in a specified order and provides indexed access to them. The Kotlin List.any() function can be used to check if the list has at least one element, or if the list has at least one element that matches the given predicate. Any is a function that is added as an extension to Iterable and Map interfaces, which take a higher-order function as param to predicate the condition and.
