Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>A bimap (or "bidirectional map") is a map that preserves the uniqueness of its values as well as that of its keys. This constraint enables bimaps to support an "inverse view", which is another bimap containing the same entries as this bimap but with reversed keys and values.</p> </blockquote> <p><a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/BiMap.html" rel="nofollow">http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/BiMap.html</a></p> <pre><code>BiMap&lt;String, Integer&gt; biMap = HashBiMap.create(); biMap.put("Mike", 123); biMap.put("John", 456); biMap.put("Steven", 789); BiMap&lt;Integer, String&gt; invertedBiMap = biMap.inverse(); </code></pre> <p><strong>Edit:</strong> <a href="http://guava-libraries.googlecode.com/svn/tags/release03/javadoc/com/google/common/collect/Multimap.html" rel="nofollow">Multimaps</a></p> <pre><code>Multimap&lt;String, String&gt; multimap = HashMultimap.create(); multimap.put("John", "111111111"); multimap.put("John", "222222222"); multimap.put("Mike", "333333333"); System.out.println(multimap.get("John")); //[222222222, 111111111] for(Map.Entry&lt;String, String&gt; entry : multimap.entries()){ if(entry.getValue().equals("222222222")){ System.out.println(entry.getKey()); //John } } //or Multimap&lt;String, String&gt; inverted = HashMultimap.create(); Multimaps.invertFrom(multimap, inverted); System.out.println(inverted.get("222222222")); //[John] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload