aspose file tools*
The moose likes Beginning Java and the fly likes convert Map into List but not get Values only get keys. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert Map into List but not get Values only get keys." Watch "convert Map into List but not get Values only get keys." New topic
Author

convert Map into List but not get Values only get keys.

Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
i want to convert Map into List so i put map.keySet() in List constructor and iterate the key using Iterator and after the completion pf while loop(in Iterator)
i again wrote a List for retrieval of Values but after the excecution of while loop means retrieving key is over after that cursor is waiting
he don't give values and also program not terminate(i also commented on that line)


Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Line 16 of your code looks like this:

There is an extra semicolon after the while. This has the effect of providing an empty loop body to the while loop, so that it works like this:

This causes the while loop to continue in an infinite loop since the iterator is never advanced with an i.next().


Steve
Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
thanks steve.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert Map into List but not get Values only get keys.