• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to take hashmap out of linkedhashmap?

 
Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 1044
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not see the exact problem, but this might help.

 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic