title: Java Multiple Array Sorting
body: <p>Hi I currently have 4 arrays all holding different data the issue i have run into is that i want to sort one of the arrays alphabetically which normally i would just do like this </p>
  
  <pre><code>class IgnoreCaseComparator implements Comparator&lt;String&gt; {
     public int compare(String strA, String strB) {
        return strA.compareToIgnoreCase(strB);
     }
  }
  IgnoreCaseComparator icc = new IgnoreCaseComparator();
  java.util.Collections.sort(ARRAY,icc);
  </code></pre>
  
  <p>Where ARRAY would be the array I want to sort Alphabetically however I need the arrays to sort together.</p>
  
  <p>So for example lets say my arrays look like this</p>
  
  <pre><code>Pet Array: [Dog, Cat, Bird]
  Owner Array: [Jim, Kyle, Joe]
  Friend Array: [Jake, Jim, John]
  Cat Array: [false, true, false]
  </code></pre>
  
  <p>And i want to sort based on Pet Array my output should be like this where all of the third values are now the first and the first values are now the third (This is way over simplified my actual arrays contains thousands of inputs)</p>
  
  <pre><code>Pet Array: [Bird, Cat, Dog]
  Owner Array: [Joe, Kyle, Jim]
  Friend Array: [John, Jim, Jake]
  Cat Array: [false, true, false]
  </code></pre>
  
  <p>Is there an easy way to do this where i can sort one array and have the others follow. Thank you for any help with this issue.</p>
  
  <p><strong>===EDIT===</strong></p>
  
  <p>Other than my solution being slightly different cause i did a little reading the checked answer is perfect i only have a slightly different return line in the compareTo method</p>
  
  <pre><code>    class Entity implements Comparable&lt;Entity&gt; {
          String Pet;
          String Owner;
          String Friend;
          int Cat;
  
          Entity(String Pet, String Owner, String Friend, int Cat) {
            this.Pet = Pet;
            this.Owner = Owner;
            this.Friend = Friend;
            this.Cat = Cat;
          }
  
          @Override
          public int compareTo(Entity other) {
              return this.Pet.compareToIgnoreCase(other.Pet);
          }
       }
  </code></pre>