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
iin 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?
iis by definition less thani+1(it is, in fact, one less), so you're going to have be more precise in your description. Did you mean the element at indexiandi+1? Also, "it should be stored in another arraylist" suggests that in "6,7,8,3,9", only 8 should be put in its own list, so again: you need edit your question to be a lot more precise.{8,3}and{10, 1}.