title: Combining enums and using getter to return a specified enum
body: <p>Let's say I have 2 different sets of enums: fruits and vegetables.</p>
  
  <pre><code>public static enum Fruits{
      APPLE ("Apple"),
      PEAR ("Pear");
  
      //constructor
      //getName()
      ... 
  }
  public static enum Vegetables{
      CARROT ("Carrot"),
      LETTUCE ("Lettuce");
  
      //constructor
      //getName()
      ...
  }
  </code></pre>
  
  <p>I display all this in a JComboBox. After someone selects something, I want to use a getter method to get back the Enum.</p>
  
  <p>For a single enum, I would do something like:</p>
  
  <pre><code>public static Fruits getEnum(String name) {
    for(Fruits fruit: Fruits.values()) {
      if(name.equals(fruit.getName())) {
        return fruit;
      }
    }
    return null;
  }
  </code></pre>
  
  <p>Any ideas what the return type is? I tried using Enum instead of Fruits. When I do that, I don't seem to have access to the getName() methods.</p>