learn java
The moose likes Beginning Java and the fly likes how to take hashmap out of linkedhashmap? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to take hashmap out of linkedhashmap?" Watch "how to take hashmap out of linkedhashmap?" New topic

how to take hashmap out of linkedhashmap?

Vinod Vijay
Ranch Hand

Joined: Sep 13, 2011
Posts: 145

Hi, i have a linkedhashmap like

If I call values() method on linkedhashmap like

then it gives following result:-

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?

Vinod Vijay Nair
Ivan Jozsef Balazs

Joined: May 22, 2012
Posts: 968
I do not see the exact problem, but this might help.

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 41640
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
Have you tried LearnNowOnline? http://www.learnnowonline.com/
subject: how to take hashmap out of linkedhashmap?