class Iterables
A collection of predefined general-purpose methods for working with Iterable
.
static fun <A : Any!> allOf(iterable: MutableIterable<A>, predicate: Predicate<in A>): Boolean
Checks if all values of provided iterable satisfy given predicate |
|
static fun <A : Any!> anyOf(iterable: MutableIterable<A>, predicate: Predicate<in A>): Boolean
Checks if any values of provided iterable satisfy given predicate |
|
static fun <A : Any!> filter(iterable: MutableIterable<A>, predicate: Predicate<in A>): MutableIterable<A>
Returns an iterable consisting only of elements that satisfy the given predicate. As the method is working directly with iterables it needs to create one, thus it returns an static fun <A : Any!, C : MutableCollection<A>!> filter(iterable: MutableIterable<A>, supplier: Supplier<out C>, predicate: Predicate<in A>): C
Returns an iterable consisting only of elements that satisfy the given predicate. It is possible to specify the type of |
|
static fun <A : Any!, B : Any!> flatMap(iterable: MutableIterable<A>, mapper: (A) -> MutableIterable<B>!): MutableIterable<B>
Returns an iterable consisting of elements that were mapped with a function that is capable of returning an iterable. As the method is working directly with an iterable it needs to create one, thus it returns an static fun <A : Any!, B : Any!, C : MutableCollection<B>!> flatMap(iterable: MutableIterable<A>, supplier: Supplier<out C>, mapper: (A) -> MutableIterable<B>!): C
Returns an iterable consisting of elements that were mapped with a function that is capable of returning an iterable. |
|
static fun <A : Any!, B : Any!> fold(iterable: MutableIterable<A>, initial: B, operator: (A, B) -> B): B
A higher-order function that takes a data structure, initial value and a combining operation to combine all the values into a single one. |
|
static fun <A : Any!> forEach(iterable: MutableIterable<A>, consumer: Consumer1<A>): Unit
Performs the given action for each element of provided static fun <A : Any!> forEach(array: Array<A>, consumer: Consumer1<A>): Unit
Performs the given action for each element of provided array. static fun <A : Any!> forEach(iterable: MutableIterable<A>, predicate: Predicate<A>, consumer: Consumer1<A>): Unit
Performs the given action for each element of the provided |
|
static fun <T : Any!> getFirst(iterable: MutableIterable<T>): Try<T>
Returns static fun <T : Any!> getFirst(iterable: MutableIterable<T>, predicate: Predicate<T>): Try<T>!
Tries to find first Iterable element that satisfies the given predicate. |
|
static fun <T : Any!> getLast(iterable: MutableIterable<T>): Try<T>
Returns static fun <T : Any!> getLast(iterable: MutableIterable<T>, predicate: Predicate<T>): Try<T>
Tries to find last Iterable element that satisfies the given predicate. |
|
static fun <A : Any!, B : Any!> lazyMap(iterable: MutableIterable<A>, mapper: (A) -> B): MutableIterable<B>
Returns a view containing the result of applying |
|
static fun <A : Any!, B : Any!> map(iterable: MutableIterable<A>, mapper: (A) -> B): MutableIterable<B>
Returns an iterable consisting of the results of applying the specified mapper to the elements of the given iterable. As the method is working directly with an iterable it needs to create one, thus it returns an static fun <A : Any!, B : Any!, C : MutableCollection<B>!> map(iterable: MutableIterable<A>, supplier: Supplier<out C>, mapper: (A) -> B): C
Returns an iterable consisting of the results of applying the specified mapper to the elements of the given iterable. It's possible to specify what underlying Iterable implementation should be returned as a result. |
|
static fun <A : Any!> reduce(iterable: MutableIterable<A>, operator: (A, A) -> A): A
A higher-order function that takes a data structure and a combining operation to combine all the values in the said structure into a single one. |