What's the issue? The code is not complete at all. Take the map declaration out of the loop. It will keep on creating new map at every iteration.
Go through collection api thoroughly and try yourself. You need to use the map's put() method a for-each loop and a bit of logic to complete the code. Best of luck
it is quite annoying that you continue to post the same question over and over again, despite having been asked repeatedly not to do that. There comes a time when it's just easier for the moderators of this site to close your account than to try to work with you. If you require further assistance with this question, ask follow-ups in the other thread where you posted this code; do not start yet another one.
subject: Storing a few records in a hashmap one by one .