Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 717
  • 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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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