HashBiMultimap

Here, there is an example about HashBiMultimap along with the guava-12.0-SNAPSHOT.jar I have compiled from a version of guava. To understand what is a HashBiMultimap data structure see [https://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplai…](https://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplai…) ```java import com.google.common.collect.HashBiMultimap; public class Test { public static void main(String[] args) { HashBiMultimap t = HashBiMultimap.create(); t.put("country", "peru"); t.put("country", "bolivia"); t.put("city", "lima"); t.put("city", "la paz"); t.put("city", "huanuco"); t.put("region", "peru"); System.out.println(t.inverse().get("peru")); } } ``` The output would be ``` [region, country] ``` Links --- * [https://code.google.com/p/guava-libraries/source/browse/guava/src/com/g…) * [http://stackoverflow.com/questions/8066109/bidirectional-multi-valued-m…](http://stackoverflow.com/questions/8066109/bidirectional-multi-valued-m…)
Etiquetas
Attachment Size
guava-12.0-SNAPSHOT.jar1.72 MB 1.72 MB
guava-libraries-637b57166d09.tar_.gz1.9 MB 1.9 MB