Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
Ritesh raushan
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks steve.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic