title: Data structure with two way O(1) lookup. Hashtable?
body: <p>I'm implementing a system where I have a list of names and each person has 1 phone number. I need to be able to take a name and look up the phone number, or take a phone number and look up a name.</p>
  
  <p>I know I could do this by having two hashtables - one which goes from names to phone numbers and one which goes from phone numbers to names. Then I can look up in either direction in O(1) time. However this seems like I am storing too much data - every name and every phone number is stored twice.</p>
  
  <p>Is there any way to do this more efficiently? What data structure should I use to store the names and phone numbers?</p>
  
  <p>I am coding in Java if that is relevant.</p>
  
  <p>Many thanks!</p>