title: Better way to find index of item in ArrayList?
body: <p>For an Android app, I have the following functionality</p>
  
  <pre><code>private ArrayList&lt;String&gt; _categories; // eg ["horses","camels"[,etc]]
  
  private int getCategoryPos(String category) {
      for(int i = 0; i &lt; this._categories.size(); ++i) {
          if(this._categories.get(i) == category) return i;
      }
  
      return -1;
  }
  </code></pre>
  
  <p>Is that the "best" way to write a function for getting an element's position? Or is there a fancy shmancy native function in java the I should leverage?</p>