Removing items from ArrayList in java 8
Removing items from ArrayList in java 8
As we know ArrayList implementation of List interface store elements in an Array under the hood. Removing elements from ArrayList is a bit costly which is the order of n^2. Let’s say I have a list of integers and I wanna remove all the nonprime number from the list. Typically what we do is, use iterator and while loop to that. We can’t iteration/removing at the time with for each loop, because we…
View On WordPress









