title: Why using Hashmap.containsKey run faster considerably than Arrays.binarySearch?
body: <p>I have two lists of phone numbers. 1st list is a subset of 2nd list. I ran two different algorithms below to determine which phone numbers are contained in both of two lists.</p>
  
  <ul>
  <li>Way 1: <br>
  
  <ul>
  <li>Sortting 1st list: Arrays.sort(FirstList); <br></li>
  <li>Looping 2nd list to find matched element: If Arrays.binarySearch(FistList, 'each of 2nd list') then OK</li>
  </ul></li>
  <li>Way 2: <br>
  
  <ul>
  <li>Convert 1st list into HashMap with key/valus is ('each of 1st list', Boolean.TRUE) <br></li>
  <li>Looping 2nd list to find matched element: If FirstList.containsKey('each of 2nd list') then OK</li>
  </ul></li>
  </ul>
  
  <p>It results in Way 2 ran within 5 seconds is faster considerably than Way 1 with 39 seconds. I can't understand the reason why.</p>
  
  <p>I appreciate your any comments.</p>