title: sort listview by existence in another arraylist
body: <p>In an android program I am creating, each user will have an arraylist preference, the code i'm using will just make the question needlessly complex, but say I have a list of pets I'm displaying in a listview.  Every page will have the entire list of pets, say</p>
  
  <pre><code>ArrayList&lt;Pet&gt; allPetsList = {"dogs", "cats", "parrots", "mice", "hamsters", "guinea pigs"}
  </code></pre>
  
  <p>The user will want to see all of the pets info, but will want to see the kind of pet they have first, so there's another array list, pets I have, which say has <code>ArrayList&lt;Pet&gt; myPets {"cats", "mice"}</code>.  How can I sort the list of all pets so it displays cats and mice first, then displays the rest?</p>
  
  <p>I was going to use </p>
  
  <pre><code>allPetsList.sort(myPetsList, new Comparator&lt;Item&gt;() {
  public int compare(Item left, Item right) {
      if (myPetsList.contains(left)) {
  return 1;
  }
  else {
  return 0;}
       }
  });`
  </code></pre>
  
  <p>but it would appear the ArrayList.sort function is deprecated, and I'm not sure if this would work anyway.  How can it be done?  I don't think it'll matter much but the Pet object contains the name string and two ints, so the variable would have to be <code>.getName()</code>.  Thanks in advance!</p>