Java bidirectional map library

The following libraries can be used when you want to refer to map from both key and value.

Guava BiMap

<!-- -->

Map<String, String> m = new HashMap<>();
m.put("a", "Ah");
m.put("i", "I");
m.put("u", "U");

BiMap<String, String> bimap = HashBiMap.create(m);

BidiMap from Apache Commons Collections

<!-- -->
import org.apache.commons.collections4.BidiMap;
import org.apache.commons.collections4.bidimap.DualHashBidiMap;

BidiMap<String, String> bidimap = new DualHashBidiMap<>(m);

Recommended Posts

Java bidirectional map library
JAVA (Map)
[Java] Map comparison
Java coverage measurement library
[Java] Stream API / map
Enum reverse map Java
Java CSV library "opencsv"
Java tree structure library
[Java] How to use Map
[Java] How to use Map
[Design pattern] Java core library
How to use Java Map
[Java] Stream (filter, map, forEach, reduce)
Get Null-safe Map values in Java
[Java] Convert 1-to-N List to Map
Try bidirectional communication with gRPC Java
Java8 list conversion with Stream map
[Java] Get List / Map elements with Iterator
Duplicate Map sorted by key in Java
Call Java library from C with JNI
[Beginner] Java method / class / external library [Note 23]
Reverse Key from Value in Java Map
Study Java Try using Scanner or Map
[Java] Use cryptography in the standard library
2018 Java Recommended library for easily creating microservices
[Java] Map # merge is hard to understand.
[Java] Let's make a DB access library!