private static <T> boolean lessThanCmp(T a, T b, Comparator<T> tieBreaker) {
    // nulls go at the end
    if (a == null) {
      return false;
    } else if (b == null) {
      return true;
    } else {
      return tieBreaker.compare(a, b) < 0;
    }
  }
Merges sorted iterators into a combined iterator over all the items.
planetiler-core/src/main/java/com/onthegomap/planetiler/collection/LongMerger.java