title: Incremental filtering of list in Java
body: <p>I am working on a project that requires me to filter through a long list of contacts by name based on a query entered by the user. The user can enter and delete characters while I am still filtering the list. For example, I might have a list containing 5000 contacts:</p>
  
  <pre><code>FirstName1  LastName1
  FirstName2  LastName2
  ...
  FirstName5000 LastName5000
  </code></pre>
  
  <p>The user has a form where he/she can enter search criteria and the list should shrink to show only those contacts that meet the search criteria. Here is the problem I have, if the user enters say </p>
  
  <pre><code>J
  </code></pre>
  
  <p>I should filter the list and only show the contacts whose first name OR last name start with 'J'. However, the user might then enter another character or delete characters, in which case I need to restart the filtering of the list. My issue of course is that I want to do this in an efficient way and not wait until the filtering is done with the letter 'J' before I start filtering with a new criteria. Any ideas/recommendations?</p>