Results 1 to 5 of 5
- 06-08-2008, 12:24 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 3
- Rep Power
- 0
Exception in thread "main" java.util.NoSuchElementException
Hi i am using hashmap to store key & value pairs
Before iterating thru hashmap i am checking !map.isEmpty() in
while(!map.isEmpty() && iter.hasNext())
It shows below error..
Exception in thread "main" java.util.NoSuchElementException
how to resolve this.
Thanks
-
I wonder if you are calling one iter.next() more than once from within the while loop? What does the code within your loop look like?
- 06-08-2008, 12:57 PM #3
Member
- Join Date
- Jun 2008
- Posts
- 3
- Rep Power
- 0
Thanks for ur reply..
The below is my code snippets
while(iter.hasNext()){
while(rs.next()){
selecting values from map
insert into table with map values
}
}
-
given what you've posted, I have no idea. What is "rs" for instance? Why does it appear that you are not using your iterator even though you are first checking it in the first while condition?...
- 06-08-2008, 02:19 PM #5
Member
- Join Date
- Jun 2008
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
[SOLVED] Exception in thread "main" java.util.NoSuchElementException
By thevoice in forum New To JavaReplies: 5Last Post: 05-14-2008, 01:43 PM -
ERROR: Exception in thread "main" java.lang.NoSuchMethodError: main
By barney in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:10 AM -
Exception in thread "main" java.net.ConnectException: Connection timed out
By osval in forum Advanced JavaReplies: 1Last Post: 07-27-2007, 10:59 PM -
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
By romina in forum New To JavaReplies: 1Last Post: 07-25-2007, 10:55 PM -
ArrayList: Exception in thread "main" java.lang.NullPointerException
By susan in forum New To JavaReplies: 1Last Post: 07-16-2007, 06:32 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks