Solved

Rewind enumeration

Posted on 2006-11-05
8
658 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse shortcuts 9 55
Why my table column Id is not passed to java object? 4 39
hibernate example using maven 12 42
sql import cannot be resolved jsp 3 20
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

770 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