class Lists
An utility class containing set of methods useful for working with lists. All methods are static.
static fun <A : Any!> allOf(list: MutableList<A>, predicate: Predicate<in A>): Boolean
Checks if the given list of values contains only values that satisfy the given predicate. |
|
static fun <A : Any!> anyOf(list: MutableList<A>, predicate: Predicate<in A>): Boolean
Checks if the given List of values contains any values that satisfy the given predicate. |
|
static fun <A : Any!> concat(left: MutableList<A>, right: MutableList<A>): MutableList<A>
Concatenates two lists, adding elements of the second list at the end of the first list. |
|
static fun <A : Any!> conditionalMap(list: MutableList<A>, predicate: Predicate<A>, mapper: (A) -> A): MutableList<A>
Performs a conditional map on the given list. Runs a given mapper function for every list element that satisfies the given predicate. Values that do not satisfy the predicate are returned without any change. |
|
static fun <A : Any!> distinct(elements: MutableList<A>): MutableList<A>
Returns a list of distinct elements from the given list. |
|
static fun <A : Any!> filter(list: MutableList<A>, predicate: Predicate<in A>): MutableList<A>!
For the given List of values returns the list of values that satisfy the given predicate. |
|
static fun <A : Any!> findFirst(list: MutableList<A>, predicate: Predicate<in A>): Try<A>!
Tries to find first List value that satisfies the given predicate. |
|
static fun <A : Any!, B : Any!> flatMap(list: MutableList<A>, function: (in A) -> out MutableIterable<B>!): MutableList<B>!
For the given list of values runs the given function on each list value and stores the returned flattened result in a list. Flattening means that instead of a List of Lists we will get only a joined List of values. |
|
static fun <B : Any!> fromIterable(iterable: MutableIterable<B>): MutableList<B>!
Creates a list from a given |
|
static fun <A : Any!> limit(list: MutableList<A>, maxSize: Int): MutableList<A>!
Creates new list based on provided list that contains no more than provide max size count. |
|
static fun <A : Any!, B : Any!> map(list: MutableList<A>, mapper: (A) -> B): MutableList<B>
For the given List of values runs the given function on each list value and stores the result in another list. |
|
static fun <A : Any!> partition(list: MutableList<A>, upperBound: Int): MutableList<MutableList<A>!>
Splits a List into Lists with an arity of 2 where each List has an inclusive upper bound on its size. |
|
static fun <A : Any!> reject(list: MutableList<A>, predicate: Predicate<in A>): MutableList<A>!
For the given List of values returns the list of values that do not satisfy the given predicate. |
|
static fun <A : Any!> replaceAll(elements: MutableList<A>, predicate: Predicate<A>, replacement: A): MutableList<A>
Replaces elements that satisfies the given predicate, in the given list, with given replacement. Values that do not satisfy the predicate are left unchanged. |
|
static fun <A : Any!> reversed(list: MutableList<A>): MutableList<A>!
For the given list this method produces its reversed copy. |