This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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 Java Interview Guide this week in the Jobs Discussion 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: 146

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: 970
I do not see the exact problem, but this might help.

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
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
I agree. Here's the link:
subject: how to take hashmap out of linkedhashmap?
It's not a secret anymore!