title: Android JSONArray equivalent of indexOf?
body: <p>I have a <code>JSONArray</code> of <code>JSONObject</code>s called <code>myArray</code>, and at some point in my code I retrieved one of the objects. For example:</p>
  
  <pre><code>JSONObject myObject = myArray.getJSONObject(x);
  </code></pre>
  
  <p>Later, I'd like to look up the index of <code>myObject</code> within <code>myArray</code>. That is, I'd like to get x back.</p>
  
  <p>Is there an "indexOf" method in Java/Android?</p>
  
  <pre><code>y = myArray.indexOf(myObject); // y should equal x
  </code></pre>
  
  <p>If not, can I loop through <code>myArray</code> and directly compare <code>myObject</code> to <code>myArray.getJSONObject(i)</code> without having to compare every element of the <code>JSONObject</code>. In other words, is <code>myObject</code> a copy or a reference to an element in <code>myArray</code>?</p>
  
  <p>Thanks.</p>