This is part of my code.
Integer keyLocation = reducedFD.indexOf(KeyPlus.get(KEYindex));
someArrayList.remove(keyLocation);
So what I am doing here is I assign keyLocation(the first occurence of a string in the reducedFD arrayList). But when I want to remove from someArrayList the item with that keyLocation, it will not work.
If I input manually:
someArrayList.remove(0); //Let's say 0 is the actual keyLocation
This actually works.
What is weird is THAT THE FOLLOWING CODE ALSO WORKS:
someArrayList.remove(keyLocation + 1);
Any hints?
Here is the main loop:
for (int KEYindex = 0; KEYindex < KeyPlus.size(); KEYindex++){
Integer keyLocation = reducedFD.indexOf(KeyPlus.get(KEYindex));
if (reducedFD.contains(KeyPlus.get(KEYindex))){
KeyPlus.add(reducedFD.get(keyLocation+1));
CheckedAttributesPlus.add(KeyPlus.get(KEYindex));
reducedFD.remove(keyLocation);
}
}