title: What's the proper way to compare a String to an enum value?
body: <p>Homework: Rock Paper Scissors game.</p>
  
  <p>I've created an enumeration:</p>
  
  <pre><code>      enum Gesture{ROCK,PAPER,SCISSORS};
  </code></pre>
  
  <p>from which I want to compare values to decide who wins--computer or human. Setting the values works just fine, and the comparisons work properly (paper covers rock, rock crushes scissors, scissors cuts paper). However, I cannot get my tie to work. The user is declared as the winner any time there's a tie.</p>
  
  <p>Ahhh...crap...this will clarify: <code>userPick</code> is a <code>String</code> with values <code>rock</code>, <code>paper</code>, or <code>scissors</code>. I'm unable to use <code>==</code> to compare <code>userPick</code> to <code>computerPick</code>, which, as you can see below, is cast as type <code>Gesture</code> from my <code>enum</code>.</p>
  
  <pre><code>      if(computer == 1)
           computerPick = Gesture.ROCK;
        else
           if(computer == 2)
             computerPick = Gesture.PAPER;
           else
             computerPick = Gesture.SCISSORS;
        if(userPick.equals(computerPick))
         {
            msg = "tie";
            ++tieGames;
         }
             etc....
  </code></pre>
  
  <p>I am guessing that there's an issue with <code>rock</code> not being equal to <code>ROCK</code>, or the <code>String userPick</code> not being able to match <code>Gesture computerPick</code> because the latter isn't a <code>String</code>. However, I'm not able to find an example of a similar circumstance in my textbook or Oracle's Java Tutorials, so I'm not sure how to correct the problem...</p>
  
  <p>Any hints?</p>