Aliucord
2.0.1
androidJvm
Aliucord
/
com.aliucord
/
CollectionUtils
Collection
Utils
open
class
CollectionUtils
Utility class to work with collections, inspired by Javascript array methods
Members
Constructors
Collection
Utils
Link copied to clipboard
constructor
(
)
Functions
every
Link copied to clipboard
open
fun
<
E
>
every
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
Boolean
Check whether all elements of the collection pass the filter
filter
Link copied to clipboard
@
NonNull
open
fun
<
E
>
filter
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
List
<
E
>
Returns a new Array containing only the elements which passed the filter
find
Link copied to clipboard
@
Nullable
open
fun
<
E
>
find
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
E
Find the first element which passes the filter
find
Index
Link copied to clipboard
open
fun
<
E
>
findIndex
(
@
NonNull
list
:
List
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
Int
Find the index of the first element which passes the filter
find
Last
Link copied to clipboard
@
Nullable
open
fun
<
E
>
findLast
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
E
Find the last element which passes the filter
find
Last
Index
Link copied to clipboard
open
fun
<
E
>
findLastIndex
(
@
NonNull
list
:
List
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
Int
Find the index of the last element which passes the filter
map
Link copied to clipboard
@
NonNull
open
fun
<
E
,
R
>
map
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
transform
:
(
E
)
->
R
)
:
List
<
R
>
Returns a new Array containing the results of the transform function for all elements
partition
Link copied to clipboard
open
fun
<
E
>
partition
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
Pair
<
List
<
E
>
,
List
<
E
>
>
Partition the collection into two Arrays.
remove
If
Link copied to clipboard
open
fun
<
E
>
removeIf
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
Boolean
Removes all elements from the collection which pass the filter
some
Link copied to clipboard
open
fun
<
E
>
some
(
@
NonNull
collection
:
Collection
<
E
>
,
@
NonNull
filter
:
(
E
)
->
Boolean
)
:
Boolean
Check whether any element of the collection passes the filter
splice
Link copied to clipboard
open
fun
<
E
>
splice
(
list
:
List
<
E
>
,
start
:
Int
)
:
List
<
E
>
Removes all elements after the specified start index
@
SafeVarargs
open
fun
<
E
>
splice
(
list
:
List
<
E
>
,
start
:
Int
,
deleteCount
:
Int
,
items
:
Array
<
E
>
)
:
List
<
E
>
Removes the specified amount of elements after the specified start index and inserts the specified items