title: Get index of enum from string?
body: <p>I have a string value, I also have an array of strings and an enum containing the range also.
  To get the index of the string in the array, from the value supplied I write this:</p>
  
  <pre><code>Arrays.asList(myClass.BAUD_RATES).indexOf(username)
  </code></pre>
  
  <p>How do I do this for an enum? Can I use ordinal? Or do i have to make my own method?</p>
  
  <p>The method might go like:</p>
  
  <pre><code>public enum Fruit {
     ...
     static public boolean isMember(String aName) {
         Fruit[] aFruits = Fruit.values();
         for (Fruit aFruit : aFruits)
             if (aFruit.fruitname.equals(aName))
                 return aFruit;
         return false;
     }
     ...
  }
  </code></pre>