Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert String to Map  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear people, can anyone help me complete this program

here i have to split this whole String "a" into broken tokens like a=100,b=200,c=300 so have used split method and now have to seperate the key and values like key:a and value:100.But should not use StringTokenizer but can use any other collection like HashMap,HashTable....etc.I dont know how to add this string array here b[] to HashMap so that i can seperate key and value using Map.Entry.Please help me!
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Split the individual contents on = this time to get the key value pairs.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!