Split list into chunks?
Posted: 04 Nov 2019 03:00
I have a list of all user apps on the device and i'm currently looping over it and executing for each item. The problem with that is that even with command timeout set to 1 it's really slow (takes over 2 mins to kill all)
My question is if there's a way (or even better a built in function) to split the list into chunks.
For example the list has 100 items and when i would do it would return a list containing 2 lists with 50 items each that i can then go through in parallel to speed up the processing
Code: Select all
am force-stop <package>
My question is if there's a way (or even better a built in function) to split the list into chunks.
For example the list has 100 items and when i would do
Code: Select all
lists = splitChunks(list, 2);
list1 = lists[0];
list2 = lists[1];