This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to store the result obtained within a while loop for further usage

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Inside a while loop , i am obtaining a result Hashmap as shown



I am passing this LinkedHashMap "hmTxn" to another Method for some data Formation , by which i obtain a hashmap .




Please let me know how can i store the returned HashMap "hmTxnForFox" so that i can have its values outside the while loop .

If i use list.add(hmTxnForFox) , i am getting only the last value . I want to have all the result outside the while loop

Please help .

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't you just create a variable outside the loop?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
really i am struck up badly with this . could you please explain what you said.

Thank you very much .
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put a List outside the while loop you can add hmTxnForFox to it - and then after the while loop is ended you have a List with the found LinkedHashMap.

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was in tense yesterday and i couldd't point out this .

Thank you very much .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic