I am trying to split the Arraylist into numbers of Arraylists with the rule:
- Split the arraylist into several sub-arraylists when the value of index
i
in arraylist is bigger than the value of indexi+1
.
For example, if there is an arraylist {6,7,8,3,9,10,1,4}
,
it should be stored as { {6,7,8}, {3,9,10}, {1,4} }
.
How can I do this one?