Thursday 3 October 2013

Previous entry Iterator -Java

Previous entry Iterator -Java

Hi i am using Iterator to iterate through a hashMap, after calling
iterator.next() is there any way to get back the previous entry (i am
looking for something like iterator.previous() )
Iterator iterator= hm.entrySet().iterator();
Map.Entry entry = (Map.Entry) iterator.next();
For now I am creating a dummy Iterator to point to the previous entry. Is
there any other way of doing this ?

No comments:

Post a Comment