title: Fastest way to find an item in a sorted ArrayList
body: <p>In Java, I have an ArrayList with a list of objects. Each object has a date field that is just a long data type. The ArrayList is sorted by the date field. I want to insert a new object into the ArrayList so that it appears in the correct position with regard to its date. The only solution I can see is to iterate through all the items and compare the date field of the object being inserted to the objects being iterated on and then insert it once I reach the correct position. This will be a performance issue if I have to insert a lot of records.</p>
  
  <p>What are some possible ways to improve this performance? Maybe an ArrayList is not the best solution?</p>