Results 1 to 2 of 2
  1. #1
    gtriant is offline Member
    Join Date
    Mar 2008
    Posts
    6
    Rep Power
    0

    Default Hashmap - get key according to value

    hello! here is what i want from santa...

    i have a hashmap with string-boolean as key/value pairs.
    sth like:

    "fact1"-true
    "fact2"-false
    "fact3"-false
    "fact4"-true
    etc...

    Is there any way that i can get from my hashmap (in any kind of array or collection) the entries/keys/"facts" with value, say, only false??

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Loop it and check. Try using the Map.Entry class and, from the Map, the getEntries method. That, at least, gives you the entries directly with a direct correlation between key and value, so you don't have to first retreive the key, in order to retreive the corresponding value, but can, rather check the value and then only pull the key if the value is in a range you want.

Similar Threads

  1. Hashmap to TXT and TXT to Hashmap
    By elvinny in forum Advanced Java
    Replies: 4
    Last Post: 02-16-2011, 11:12 PM
  2. hashmap
    By tOpach in forum New To Java
    Replies: 2
    Last Post: 09-24-2008, 12:55 PM
  3. Hashmap
    By dirtycash in forum New To Java
    Replies: 5
    Last Post: 12-03-2007, 02:58 AM
  4. what is hashmap
    By gabriel in forum New To Java
    Replies: 5
    Last Post: 08-03-2007, 01:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •