Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

Storing a few records in a hashmap one by one .

 
kirankkmm kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Report post to moderator

I need to store a a number of records in hashmap by reading it from text file.

below is the code .






//testall.ldif


dn: uid=br152, ou=People, dc=acceg,dc=ag,dc=com
displayName: br152
homePhone: 87878
givenName: Nickkk
aigrole: SWC_Brokery
mobile: 888667575

dn: uid=br152g, ou=People, dc=acce,dc=ng,dc=com
displayName: br152g
homePhone: 56565
givenName: Nickfsfsf
aigrole: SWoker
mobile: 343434675


dn: uid=br1, ou=People, dc=achg,dc=aig,dc=com
displayName: br1
homePhone:
givenName: dfdf
aigrole: dfser
mobile: 6575755756



The output should be as below





Please do the needful ,help me to resolve this issue.


thanks in advance

 
Soumyajit Hazra
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Soumyajit Hazra
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Report post to moderator
Take a look at Head First Java.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
"kirankkmm kumar",
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.
 
    Bookmark Topic Watch Topic
  • New Topic