Solved

Rewind enumeration

Posted on 2006-11-05
8
666 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 86

Assisted Solution

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


List values = Collections.list(enumeration);
0
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 214
fibonacci ten numbers 4 45
servlet example 17 53
American Express @Work site and Java 4 33
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to implement Singleton Design Pattern in Java.
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.

820 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