aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to take hashmap out of linkedhashmap?" Watch "how to take hashmap out of linkedhashmap?" New topic
Author

how to take hashmap out of linkedhashmap?

Vinod Vijay
Ranch Hand

Joined: Sep 13, 2011
Posts: 119

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?


Vinod Vijay Nair
Ivan Jozsef Balazs
Rancher

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

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36501
    
  16
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: http://aspose.com/file-tools
 
subject: how to take hashmap out of linkedhashmap?
 
Similar Threads
Need to store the result obtained within a while loop for further usage
how hashmap identify the duplicate values? (i need internal logic)
Difference between HashMap and LinkedHashMap
collections framework
Using object as keys in maps