/** * Returns a {@code DoubleCollector} which partitions the input elements * according to a {@code DoublePredicate}, and organizes them into a * {@code Map<Boolean, double[]>}. * * There are no guarantees on the type, mutability, serializability, or * thread-safety of the {@code Map} returned. * * @param predicate a predicate used for classifying input elements * @return a {@code DoubleCollector} implementing the partitioning operation */ static DoubleCollector<?, Map<Boolean, double[]>> partitioningBy(DoublePredicate predicate) { return partitioningBy(predicate, toArray()); }
/** * Returns a {@code DoubleCollector} implementing a "group by" operation on * input numbers, grouping them according to a classification function, and * returning the results in a {@code Map}. * * <p> * The classification function maps elements to some key type {@code K}. The * collector produces a {@code Map<K, double[]>} whose keys are the values * resulting from applying the classification function to the input numbers, * and whose corresponding values are arrays containing the input numbers * which map to the associated key under the classification function. * * <p> * There are no guarantees on the type, mutability, serializability, or * thread-safety of the {@code Map} objects returned. * * @param <K> the type of the keys * @param classifier the classifier function mapping input elements to keys * @return a {@code DoubleCollector} implementing the group-by operation */ static <K> DoubleCollector<?, Map<K, double[]>> groupingBy(DoubleFunction<? extends K> classifier) { return groupingBy(classifier, toArray()); }