Adds the comparator, that uses a function for extract
a {@code double} sort key, to the chain.

@param keyExtractor  the function that extracts the sort key
@return the new {@code ComparatorCompat} instance
351307
@NotNull
    public ComparatorCompat<T> thenComparingDouble(@NotNull ToDoubleFunction<? super T> keyExtractor) {
        return thenComparing(comparingDouble(keyExtractor));
    }
213496
public JRecordExtractor<T, SparseLabeledPoint>
  extractWithSubsetSettingsSparseLabeledPoint(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSubsetSettingsSparseLabeledPoint(self, settings));
  }
317405
public JRecordExtractor<T, DoubleNamedSparseArray>
  extractWithSettingsDoubleNamedSparseArray(String settings) {
    return new JRecordExtractor<>(
            JavaOps.extractWithSettingsDoubleNamedSparseArray(self, settings));
  }
970137
@NotNull
    public ComparatorCompat<T> thenComparingLong(@NotNull ToLongFunction<? super T> keyExtractor) {
        return thenComparing(comparingLong(keyExtractor));
    }
208844
@Override
    public <T extends GraphQLType> Comparator<? super T> getComparator(SchemaPrinterComparatorEnvironment environment) {
        Comparator<?> comparator = registry.get(environment);
        if (comparator != null) {
            //noinspection unchecked
            return (Comparator<? super T>) comparator;
        }
        comparator = registry.get(environment.transform(builder -> builder.parentType(null)));
        if (comparator != null) {
            //noinspection unchecked
            return (Comparator<? super T>) comparator;
        }
        return DEFAULT_COMPARATOR;
    }
848129
public JRecordExtractor<T, FloatNamedSparseArray>
  extractWithSettingsFloatNamedSparseArray(String settings) {
    return new JRecordExtractor<>(JavaOps.extractWithSettingsFloatNamedSparseArray(self, settings));
  }
149547
public static ColumnValueSelector<ExprEval> makeExprEvalSelector(
      ColumnSelectorFactory columnSelectorFactory,
      Expr expression
  )
  {
    final List<String> columns = Parser.findRequiredBindings(expression);

    if (columns.size() == 1) {
      final String column = Iterables.getOnlyElement(columns);
      final ColumnCapabilities capabilities = columnSelectorFactory.getColumnCapabilities(column);

      if (capabilities != null && capabilities.getType() == ValueType.LONG) {
        // Optimization for expressions that hit one long column and nothing else.
        return new SingleLongInputCachingExpressionColumnValueSelector(
            columnSelectorFactory.makeColumnValueSelector(column),
            expression,
            !ColumnHolder.TIME_COLUMN_NAME.equals(column) // __time doesn't need an LRU cache since it is sorted.
        );
      } else if (capabilities != null
                 && capabilities.getType() == ValueType.STRING
                 && capabilities.isDictionaryEncoded()) {
        // Optimization for expressions that hit one string column and nothing else.
        return new SingleStringInputCachingExpressionColumnValueSelector(
            columnSelectorFactory.makeDimensionSelector(new DefaultDimensionSpec(column, column, ValueType.STRING)),
            expression
        );
      }
    }

    final Expr.ObjectBinding bindings = createBindings(expression, columnSelectorFactory);

    if (bindings.equals(ExprUtils.nilBindings())) {
      // Optimization for constant expressions.
      return new ConstantExprEvalSelector(expression.eval(bindings));
    }

    // No special optimization.
    return new ExpressionColumnValueSelector(expression, bindings);
  }
1016656
public static <T, K> Func1<Iterable<T>, SolidMap<K, T>> toSolidMap(final Func1<T, K> keyExtractor) {
        return toSolidMap(keyExtractor, new Func1<T, T>() {
            @Override
            public T call(T value) {
                return value;
            }
        });
    }
432742
public EventBuilder withExtra(String extraName, Object extraValue) {
        event.getExtra().put(extraName, extraValue);
        return this;
    }
357381
public static <T> Builder<T> newSorter(Serializer<T> serializer, Comparator<T> comparator) {
        return new Builder<T>(serializer, comparator);
    }
136843
public static <T> ItemsUnion<T> getInstance(final Comparator<? super T> comparator) {
    return new ItemsUnion<T>(PreambleUtil.DEFAULT_K, comparator, null);
  }
598764
public static Sort.Order toSortOrder(ComparatorItem comparatorItem) {
    if (comparatorItem == null || comparatorItem.getField() == null
        || comparatorItem.getField().trim().length() == 0) {
      return null;
    }
    Sort.Direction direction = comparatorItem.isAsc() ? Sort.Direction.ASC : Sort.Direction.DESC;
    Sort.NullHandling nullHandlingHint =
        comparatorItem.isNullIsFirst() ? Sort.NullHandling.NULLS_FIRST
            : Sort.NullHandling.NULLS_LAST;
    Sort.Order order = new Sort.Order(direction, comparatorItem.getField(), nullHandlingHint);
    if (comparatorItem.isIgnoreCase()) {
      return order.ignoreCase();
    }
    return order;
  }
820589
public DependentKeyIndex createDependentKeyIndex(CacheLoaderEngine cacheLoaderEngine, Extractor[] keyExtractors, Operation ownerObjectFilter)
    {
        DependentKeyIndex dependentKeyIndex = null;

        for (DependentKeyIndex each : this.dependentKeyIndexes)
        {
            if (Arrays.equals(each.getKeyExtractors(), keyExtractors))
            {
                dependentKeyIndex = each;
                break;
            }
        }

        if (dependentKeyIndex == null)
        {
            dependentKeyIndex = (keyExtractors.length > 1)
                    ? new DependentTupleKeyIndex(cacheLoaderEngine, this, keyExtractors)
                    : new DependentSingleKeyIndex(cacheLoaderEngine, this, keyExtractors);

            dependentKeyIndex.setOwnerObjectFilter(ownerObjectFilter);

            final LoadingTaskThreadPoolHolder threadPoolHolder = cacheLoaderEngine.getOrCreateThreadPool(this.getThreadPoolName());
            dependentKeyIndex.setLoadingTaskThreadPoolHolder(threadPoolHolder);
            threadPoolHolder.addDependentKeyIndex(dependentKeyIndex);
            this.dependentKeyIndexes.add(dependentKeyIndex);
        }
        else
        {
            dependentKeyIndex.orOwnerObjectFilter(ownerObjectFilter);
        }
        return dependentKeyIndex;
    }
544856
public <T> HttpAuthServiceBuilder addTokenAuthorizer(
            Function<HttpHeaders, T> tokenExtractor, Authorizer<? super T> authorizer) {
        requireNonNull(tokenExtractor, "tokenExtractor");
        requireNonNull(authorizer, "authorizer");
        final Authorizer<HttpRequest> requestAuthorizer = (ctx, req) -> {
            final T token = tokenExtractor.apply(req.headers());
            if (token == null) {
                return CompletableFuture.completedFuture(false);
            }
            return authorizer.authorize(ctx, token);
        };
        add(requestAuthorizer);
        return this;
    }
1222055
public static WritableComparator get(Class<? extends WritableComparable> c) {
        WritableComparator comparator = comparators.get(c);
        if (comparator == null) {
            // force the static initializers to run
            forceInit(c);
            // look to see if it is defined now
            comparator = comparators.get(c);
            // if not, use the generic one
            if (comparator == null) {
                comparator = new WritableComparator(c, true);
            }
        }
        return comparator;
    }
500572
public Comparator<Columns> comparator() {
        return new Comparator<Columns>() {
            public int compare(Columns o1, Columns o2) {

                if (o1 == null) {
                    return o2 == null ? 0 : 1;
                }
                if (o2 == null) {
                    return -1;
                }

                Column column1 = o1.getColumn(field);
                Column column2 = o2.getColumn(field);

                if (column1 == null) {
                    return column2 == null ? 0 : 1;
                }
                if (column2 == null) {
                    return -1;
                }

                AbstractType<?> type = column1.getType();
                ByteBuffer value1 = column1.getDecomposedValue();
                ByteBuffer value2 = column2.getDecomposedValue();
                return reverse ? type.compare(value2, value1) : type.compare(value1, value2);
            }
        };
    }
159938
@Override
    public void sortAtomContainers(final Comparator<IAtomContainer> comparator) {

        // need to use boxed primitives as we can't customise sorting of int primitives
        Integer[] indexes = new Integer[atomContainerCount];
        for (int i = 0; i < indexes.length; i++)
            indexes[i] = i;

        // proxy the index comparison to the atom container comparator
        Arrays.sort(indexes, new Comparator<Integer>() {

            @Override
            public int compare(Integer o1, Integer o2) {
                return comparator.compare(atomContainers[o1], atomContainers[o2]);
            }
        });

        // copy the original arrays (we could modify in place with swaps but this is cleaner)
        IAtomContainer[] containersTmp = Arrays.copyOf(atomContainers, indexes.length);
        Double[] multipliersTmp = Arrays.copyOf(multipliers, indexes.length);

        // order the arrays based on the order of the indices
        for (int i = 0; i < indexes.length; i++) {
            atomContainers[i] = containersTmp[indexes[i]];
            multipliers[i] = multipliersTmp[indexes[i]];
        }

    }