title: Sorting an object ArrayList by an attribute value in Java
body: <p>I have <code>ArrayList zombie</code>, which is populated with an object called <code>Zombie</code>. <code>Zombie</code> has the attributes <code>health</code>, <code>x</code>, <code>y</code>. How would I sort the array in ascending order, using the attribute <code>x</code> of <code>Zombie</code>, which is set to initially have random values?</p>
  
  <p>I have already found a possible <a href="https://stackoverflow.com/questions/4310014/sort-an-arraylist-base-on-multiple-attributes">solution</a> to my problem, but I do not understand the syntax of the answer. Explaining that answer may help, also.</p>