title: Why does HashSet implementation in Sun Java use HashMap as its backing?
body: <p>Looking at the source of Java 6, <code>HashSet&lt;E&gt;</code> is actually implemented using <code>HashMap&lt;E,Object&gt;</code>, using dummy object instance on every entry of the Set. </p>
  
  <p>I think that wastes 4 byte (on 32-bit machines) for the size of the entry itself. </p>
  
  <p>But, why is it still used? Is there any reason to use it besides making it easier to maintain the codes?</p>