getting key coresponding to value in hashtable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atul123456789
    New Member
    • Jul 2007
    • 9

    #1

    getting key coresponding to value in hashtable

    Hi

    can i get key corresponding to a particular value in hashtable in java.

    we can get value corresponding to particular key but if we want to get key corresponding to particular value.........
    Do write code
    How?

    Thanks'
    Atul
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by atul123456789
    Hi

    can i get key corresponding to a particular value in hashtable in java.

    we can get value corresponding to particular key but if we want to get key corresponding to particular value.........
    You need another Map for that but beware that different keys in the first map
    may have identical values in the second map, so if the first map has type:

    [code=java]
    Map<K, V>
    [/code]

    then the second Map needs to have a type:

    [code=java]
    Map<V, List<K>>
    [/code]

    or similar.

    Originally posted by atul123456789
    Do write code
    How?
    I do write a lot of code; do you?

    kind regards,

    Jos

    Comment

    Working...