porting native code to Kotlin, if I want to move a...
# announcements
e
porting native code to Kotlin, if I want to move a group of elements in an Arraylist up front, what's my best option? C++ uses
stable_partition
Copy code
Move elements for which a predicate is true to the beginning
*         of a sequence, preserving relative ordering.
I'm thinking about creating a new Arraylist, put there all the element as I find (and remove) them (from the original list), then inserting them all up front, one by one in the same order
also, actually I can use
partition
and add the first list into the second (original)
y
You could maybe also do
removeAll
then
addAll
with the respective indicies