title: What is the most space efficient way to store a mapping from string to integer
body: <p>Basically I need to store in memory a set of string and be able to get the unique integer associated with one string and the string associated with one integer.</p>
  
  <p>So it seem like I need something that implement Map&lt;String,Integer&gt; as well as Map&lt;integer,String&gt; but I don't need to decide the integer as long as they are unique.</p>
  
  <p>One option I was thinking of doing is store a Trie where the leaf node contain the integer and a array of pointer to leaf-node sorted by integer value.</p>
  
  <p>Is there a more compact way to store this in memory while still having good retrieval performance?</p>