• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 715
  • Last Modified:

Rewind enumeration

Enumeration keys = hashtable.keys();
while(keys.hasMoreElements()){
      Vector vConsultn=(Vector) hashtable.get(keys.nextElement());
}

//rewind the keys again<--how to do this??

while(keys.hasMoreElements()){
      Vector vabc=(Vector) hashtable.get(keys.nextElement());
}

0
william007
Asked:
william007
  • 2
  • 2
  • 2
  • +2
3 Solutions
 
hoomanvCommented:
Impossible
You should get the Enumeration again
0
 
kupra1Commented:
There is only one way out i.e. get the keys again from the collection.
So, put this statement again after the first loop.
        Enumeration keys = hashtable.keys();

Once you have looped over the enumeration, the cursor stays after the last element of the enumeration. So, you need to get another enumeration from the same collection.
0
 
hoomanvCommented:
kupra1, Please respect the rules
Comment a solution that has not been mentioned by others yet
You did the same in other Qs
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
CEHJCommented:
You could do


List values = Collections.list(enumeration);
0
 
ManishLeadCommented:
Enumeration keys1 = hashtable.keys();
while(keys1 .hasMoreElements()){
     Vector vabc=(Vector) hashtable.get(keys1 .nextElement());
}
0
 
ManishLeadCommented:
sorry , I didnt see previous comments.
0
 
william007Author Commented:
Thanks:-)
0
 
CEHJCommented:
:-)
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now