This is my map with iterators to remove some data based on some conditions, now I want to run the same map in reverse direction and conditions accordingly.
But I couldn't find any ListIterator
to go back easily.
How Can I go about this ?
Also the Map
implementation I am using is a TreeMap
for(int i=countIteration;i<(countIteration+2);i++)
{
Iterator it = imageFilexxSm.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
if(pairs.getKey().equals(data1.get(i).replace(".png", ".mp3")))
{
it.remove();
}
}
Iterator itr = imageFilexxS.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry pairsx = (Map.Entry)itr.next();
if(pairsx.getKey().equals(data1.get(i)))
{
System.out.println("entry deleted."+pairsx.getKey());
itr.remove();
}
}
}