Collections
A basic collection of array functions.
Installation
You know how to install it, or look up and to the right.
Usage
-
flatten(arr)
: [], flattens the array -
associate(arr, keySelector, valueSelector)
: {}, associates every value in arr to k -> v -
chunked(arr, size, transform)
: [], chunks elements in arr and then transforms the chunk -
union(...arrs)
: [], returns union of all arrs. -
distinct(arr)
: [], distinct elements by equal -
drop(arr, amt)
: [], drops amt cards from the arr -
drop(arr, pred)
: [], drops first elems where pred is true -
take(arr, amt)
: [], takes amt elems from arr -
takeWhile(arr, pred)
: [], takes first elems where pred is true -
group(arr, keySelector)
: [], groups elements into sub arrays based on keySelector -
partition(arr, pred)
: [ [falsy], [truthy] ], groups elements into two arrays, the first is falsy the second is truthy based on pred. -
zip(arr1, arr2)
: [], pairs elements of arr1 and arr2 in result array
Yoinked from Kotlin Collections Library
License
MIT