Is there a standard function that would split coll...
# stdlib
d
Is there a standard function that would split collection into buckets depending on some parameter?
s
sounds kinda like you want
.groupBy { ... }
going to have to be more specific on what you mean by “buckets” and “depending on some parameter”
p
there is also
.partition{...}
for simpler cases
s
correct, if you have a boolean predicate, partition might be a better choice
d
yeah something like partition but without predefined number of partitions
I guess groupby will work for me, if I then strip the keys
s
you can call
.values
on the resulting map to get a collection containing your “buckets”
d
yeah, I should have thought about groupBy, thank you
👍 2
h
Sequence<T>.chunked()
s
@hmole sure, if “some parameter” is just the number of elements you want in each resulting list
the request was vague enough that I figured they wanted just arbitrary criterion support