We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Rewind enumeration

william007
william007 asked
on
Medium Priority
761 Views
Last Modified: 2012-05-05
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());
}

Comment
Watch Question

Top Expert 2006
Commented:
Impossible
You should get the Enumeration again

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Commented:
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.
Top Expert 2006

Commented:
kupra1, Please respect the rules
Comment a solution that has not been mentioned by others yet
You did the same in other Qs
CERTIFIED EXPERT
Top Expert 2016
Commented:
You could do


List values = Collections.list(enumeration);
ManishLead
CERTIFIED EXPERT

Commented:
Enumeration keys1 = hashtable.keys();
while(keys1 .hasMoreElements()){
     Vector vabc=(Vector) hashtable.get(keys1 .nextElement());
}
ManishLead
CERTIFIED EXPERT

Commented:
sorry , I didnt see previous comments.

Author

Commented:
Thanks:-)
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.