Here is my code:
for (int i = 0; i < myarraylist.size(); i++) {
for (int j = 0; j < stopwords.size(); j++) {
if (stopwords.get(j).e
Using ListIterator
ArrayList list = new ArrayList();
// List : ["java", ".net", "javascript", "html", "css", "selenium", "image", "Spring"]
ArrayList indexes = new ArrayList();
// indexes : [5, 3, 2, 5, 0]
// Sort the Indexes in Order to remove from back words. and make Unique
TreeSet uniqueSorted = new TreeSet();
uniqueSorted.addAll(indexes);
// To remove all elements from the ArrayList and make its size = 0
indexes.clear();
indexes.addAll(uniqueSorted);
// Iterate form back, so that if size decreases also no problem.
ListIterator li = indexes.listIterator(indexes.size());
// we can traverse a List in both the directions (forward and Backward).
while(li.hasPrevious()) {
int position = li.previous();
list.remove(position);
}