About 21,400,000 results
Open links in new tab
  1. Java Hashmap: How to get key from value? - Stack Overflow

    Sep 5, 2009 · Obtaining a key for a value is supported by the getKey() method. There is a caveat though, bidi maps cannot have multiple values mapped to keys, and hence unless your data …

  2. Java Program to Get key from HashMap using the value

    In this example, we will learn to get the key from HashMap using the value in Java.

  3. HashMap get() Method in Java - GeeksforGeeks

    Jan 4, 2025 · The java.util.HashMap.get () method of HashMap class is used to retrieve or fetch the value mapped by a particular key mentioned in the parameter. It returns NULL when the …

  4. Get the Key for a Value from a Java Map - Baeldung

    Jul 25, 2024 · This class provides a method named inverse () to get the value-key Map or the reverse Map to fetch the key based on a given value: HashBiMap<String, String> …

  5. Java HashMap - How to Get Key from Value – TecAdmin

    Apr 26, 2025 · In this tutorial, you will learn Java examples to get keys from a HashMap based on a defined value. The Entry interface provides a number of methods to access key values from …

  6. How to get Key From Value in Hashtable, HashMap in Java? Example - Blogger

    Feb 19, 2013 · Java Hashtable, HashMap or any other Map implementation are unidirectional e.g. you can get value if you have key but not vice-versa. In this Java tutorial, we will learn a trick …

  7. Java 8 – How to get Keys from Value in HashMap using Stream

    Dec 23, 2022 · In this article, we will discuss how to get Keys from Value in Map or Map implemented classes like HashMap, LinkedHashMap or TreeMap using Java 8 Stream. Before …

  8. Java Hashmap: How to get key from value? - W3docs

    Java Hashmap: How to get key from value? To get the key for a given value in a java.util.HashMap, you can use the entrySet() method of the java.util.HashMap class to get a …

  9. How to get values and keys from HashMap? - Stack Overflow

    Apr 27, 2013 · To get key and value from the entry you use accessor and modifier methods. If you want to get values with given key, use get() method and to insert value, use put() method. If …

  10. How to Retrieve a Key from a Value in a Java HashMap?

    Retrieving a key from a value in a Java HashMap requires an iteration over the entries of the map, as HashMaps are not designed to efficiently perform reverse lookups (key to value). Below are …

Refresh