Reverse Key from Value in Java Map

Since Java Map is not bidirectional, Value can be retrieved from Key, but Key cannot be retrieved from Value. There seems to be a list type library for that, but is there a good way to do it ...

Stream.of(fooMap)
    .takeUntil(fooItem -> fooItem.getValue() == targetValue)
    .findLast().get().getKey();

I'm writing this using the Lightweight-Stream-API, but I'm not sure if it's there. If possible, I'd like to search by O (1) ... I wonder if there is no choice but to make a map in the opposite direction?

Recommended Posts

Reverse Key from Value in Java Map
Duplicate Map sorted by key in Java
Enum reverse map Java
Sort Map values in ascending key order in Java TreeMap
Reverse Enum constants from strings and values in Java
[Java] How to get the key and value stored in Map by iterative processing
Get Null-safe Map values in Java
Use composite keys in Java Map.
JAVA (Map)
How to increment the value of Map in one line in Java
Study Deep Learning from scratch in Java.
Call Java method from JavaScript executed in Java
Key points for introducing gRPC in Java
OCR in Java (character recognition from images)
Map without using an array in java
Using JavaScript from Java in Rhino 2021 version
Get history from Zabbix server in Java
GetInstance () from a @Singleton class in Groovy from Java
Partization in Java
Java method call from RPG (method call in own class)
Changes in Java 11
[Java] Be careful of the key type of Map
Rock-paper-scissors in Java
How to get Class from Element in Java
Text extraction in Java from PDF with pdfbox-2.0.8
Capture and save from selenium installation in Java
Get unixtime (seconds) from ZonedDateTime in Scala / Java
[Java] Map comparison
[Java] Get multiple values from one return value
[Java] Get a random value from an array
[Deep Learning from scratch] in Java 3. Neural network
Pi in Java
Generate OffsetDateTime from Clock and LocalDateTime in Java
FizzBuzz in Java
[Java] Get KFunction from Method / Constructor in Java [Kotlin]
Output the maximum value from the array using Java standard output
Delete All from Java SDK in Azure Cosmos DB
[Swift] Get key as well as value in Realtime database
Call a program written in Swift from Processing (Java)
[memo] Generate RSA key pair for SSH in Java
[java] sort in list
Read JSON in Java
Interpreter implementation in Java
Make Blackjack in Java
Call Java from JRuby
Rock-paper-scissors app in Java
Constraint programming in Java
Put java8 in centos7
Changes from Java 8 to Java 11
Sum from Java_1 to 100
NVL-ish guy in Java
Combine arrays in Java
"Hello World" in Java
Callable Interface in Java
[Java] Stream API / map
Eval Java source from Java
Azure functions in java
Format XML in Java
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Hello World in Java