title: Enum used as key in TreeMap not sorted after adding
body: <p>I am using a TreeMap, where key is an enum and value is an integer.</p>
  
  <pre><code>     TreeMap&lt;Ingredient, Integer&gt; inv;
  
       public Inventory(){
          inv = new  TreeMap&lt;Ingredient, Integer&gt;();
          inv.put(Ingredient.COFFEE, 10);
          inv.put(Ingredient.DECAF_COFFEE, 10);
          // and so on
       }
  </code></pre>
  
  <p>The Ingredient class is defined as </p>
  
  <pre><code>public enum Ingredient {
  
  COFFEE {
      public double getCost() {
          return 0.75;
      }
  
      @Override
      public String toString() {
          return "Coffee";
      }
  },
  DECAF_COFFEE {
      public double getCost() {
          return 0.75;
      }
  
      @Override
      public String toString() {
          return "Decaf Coffee";
      }
  },
  </code></pre>
  
  <p>// and so on</p>
  
  <p>However, when i iterate the treemap after adding all the ingredients, the enum keys are not printed in lexicographical order.</p>
  
  <p>If instead of enum it was a class I would be implementing compareto, can i do something similar for enum?</p>