title: how to sort a list according to a specific field in one line? (in java)
body: <p>Given a list (ArrayList), containing items from a specific class (also given, called "Point"), how can I sort the list according to a specific field(of type int) in Point class (only the x-dimension)?</p>
  
  <p>I tried <a href="https://stackoverflow.com/questions/13851980/using-the-sort-function-to-sort-a-list-according-to-a-function">this answer</a>, and I know the function: Collections.sort(list_name, new comperator_name) usually works - but I cannot change the class point or change anything other than one line in the main function.</p>
  
  <p>Two solutions would be appreciated: one for a point class without "compare" or "compareTo" functions, and one with a "compare" function.</p>
  
  <p>Edit: for some reason someone suggested <a href="https://stackoverflow.com/questions/2784514/sort-arraylist-of-custom-objects-by-property">this</a> as a duplicate - and I saw it before, but specifically asked for a solution that does not need to implement a comperator.</p>