code: private int compare(Object key1, Object key2) {
          if (comparator == null)
              return ((Comparable) key1).compareTo(key2);
          else
              return comparator.compare(key1, key2);
      }
docs: Use the comparator to compare the two keys.
  
  @param key1 first key to compare.
  @param key2 second key to compare.
  @return int -1 if key1 < key2 0 if key1 = key2 1 if key1 > key2