posted 11 years ago
Dear All.
Can someone explain me why it is happening.
If I construct ArraysList of integers containing 4, 1, 3, 6, 4, 4, 1;
then get sublist from index 1 to index 4- I will get new collection 1,3,6
Then If I will call removeAll(subList) original collection will hold 4, 4, 1.
Output:
1: [4, 1, 3, 6, 4, 4, 1]
sub: [1, 3, 6]
2: [4, 4, 1]
Note If I will not use sublist removeAll will remove all 1,3,6 so I will get 4,4,4.
Why removeAll behave this way when used on subList?