This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to take hashmap out of linkedhashmap?

 
Vinod Vijay
Ranch Hand
Posts: 158
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a linkedhashmap like


If I call values() method on linkedhashmap like


then it gives following result:-
[{PK_FUNCTION_ID=1, MENU_NAME=GOOGLE}, {PK_FUNCTION_ID=2, MENU_NAME=YAHOO}, {PK_FUNCTION_ID=3, MENU_NAME=REDIFF}]

I want to read only the MENU_NAME and put it into some list. Hashmap is easy, just key value pair. This is again key value pair only in other way but linked. Is there any ready method or way to read MENU_NAME or woraround like to substring by putting check '}' and/or 'MENU_NAME='?

Can you please give me some idea?
 
Ivan Jozsef Balazs
Rancher
Posts: 981
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not see the exact problem, but this might help.

 
Campbell Ritchie
Sheriff
Pie
Posts: 50235
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand the problem. If you are sure the menuCache object is a LinkedHashMap, why worry about the linked bit? All that affects is the order you read the Entries, Keys or Values when you iterate the Map. What worries me is that you have a Map<String, Object>. You ought to have a Map with PK_Functions as its “V” type. Then you can write
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic