Solved

Rewind enumeration

Posted on 2006-11-05
8
648 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());
}

0
Comment
Question by:william007
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 14

Accepted Solution

by:
hoomanv earned 250 total points
ID: 17879113
Impossible
You should get the Enumeration again
0
 
LVL 10

Assisted Solution

by:kupra1
kupra1 earned 100 total points
ID: 17879225
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
 
LVL 14

Expert Comment

by:hoomanv
ID: 17879259
kupra1, Please respect the rules
Comment a solution that has not been mentioned by others yet
You did the same in other Qs
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 150 total points
ID: 17879298
You could do


List values = Collections.list(enumeration);
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 11

Expert Comment

by:Manish
ID: 17879535
Enumeration keys1 = hashtable.keys();
while(keys1 .hasMoreElements()){
     Vector vabc=(Vector) hashtable.get(keys1 .nextElement());
}
0
 
LVL 11

Expert Comment

by:Manish
ID: 17879539
sorry , I didnt see previous comments.
0
 
LVL 9

Author Comment

by:william007
ID: 17932840
Thanks:-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17932861
:-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
return in catch statement 1 40
json format text only 4 65
wordcount challenge 11 78
firstChar challenge 13 86
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now