title: Implement binary search in objects
body: <p>Is there any way to implement binary search in a ArrayList with objects? In this example the ArrayList will be sorted with the field 'id'.</p>
  
  <pre><code>class User{
   public int id;
   public string name;
  }
  
  ArrayList&lt;User&gt; users = new ArrayList&lt;User&gt;();
  
  sortById(users);
  
  int id = 66
  User searchuser = getUserById(users,id);
  </code></pre>
  
  <p>How would the "User getUserById( ArrayList users, int userid )" look like if I it should return the user with a specified id using binary search? Is this even possible?</p>