public final class DblTransformUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static double[] |
dblFlatMap(double[] doubles,
java.util.function.DoubleFunction<double[]> function)
Given an array of doubles, and a
DoubleFunction<double[]> (a function that takes a double and
returns an array of doubles), returns an array of doubles. |
static double[] |
dblFlatMapDistinct(double[] doubles,
java.util.function.DoubleFunction<double[]> function)
Given an array of doubles, and a
DoubleFunction<double[]> (a function that takes a double and
returns an array of doubles), returns an array of distinct primitive double values. |
static <C extends java.util.Collection<java.lang.Double>> |
dblTransform(double[] doubles,
java.util.stream.Collector<java.lang.Double,?,C> collector)
Given an array of doubles, and a
Collector<Double, ?, C>, returns a
Collection<C> of Double elements. |
static <U,C extends java.util.Collection<U>> |
dblTransform(double[] doubles,
org.perro.functions.mapper.DblTransformerCollector<U,C> transformerCollector)
Given an array of doubles, and a
DblTransformerCollector<U, C> that contains a
DoubleFunction<U> to transform double values into elements of type <U>, and a
Collector<U, ?, C>, returns a collection of type <C> of those elements. |
static <R> java.util.List<R> |
dblTransform(double[] doubles,
java.util.function.DoubleFunction<R> transformer)
Given an array of doubles, and a
DoubleFunction<R> that transforms those doubles into elements
of type <R>, returns a List<R> of those elements. |
static <U,C extends java.util.Collection<U>> |
dblTransformAndThen(java.util.function.DoubleFunction<U> transformer,
java.util.stream.Collector<U,?,C> collector)
Builds a
DblTransformerCollector<U, C> that contains a DoubleFunction<U> to
transform primitive double values into elements of type <U>, and a Collector<U, ?, C> to
collect those elements into a collection of type <C>. |
static <R> java.util.List<R> |
dblTransformDistinct(double[] doubles,
java.util.function.DoubleFunction<R> transformer)
Given an array of doubles, and a
DoubleFunction<R> that transforms those doubles to elements
of type <R>, returns a List<R> of those elements, which will contain only unique values
(according to Object.equals(Object)). |
static <K,V> java.util.Map<K,V> |
dblTransformToMap(double[] doubles,
org.perro.functions.mapper.DblKeyValueMapper<K,V> keyValueMapper)
Given an array of primitive doubles, and a
DblKeyValueMapper containing a
DoubleFunction to transform a double to a key of type <K>, and another
DoubleFunction to transform a double to a value of type <V>, returns a
Map<K, V>. |
static <R> java.util.Set<R> |
dblTransformToSet(double[] doubles,
java.util.function.DoubleFunction<R> transformer)
Given an array of doubles, and a
DoubleFunction<R> that transforms those doubles to an element
of type <R>, returns a Set<R> of those elements. |
static double[] |
dblUnaryTransform(double[] doubles,
java.util.function.DoubleUnaryOperator operator)
Given an array of doubles, and a
DoubleUnaryOperator that transforms each of those doubles to
another double, returns an array of the resulting double values. |
static double[] |
dblUnaryTransformDistinct(double[] doubles,
java.util.function.DoubleUnaryOperator operator)
Given an array of doubles, and a
DoubleUnaryOperator that transforms each of those doubles to
another double, returns an array of the resulting double values, which will contain only distinct
values. |
static <T> double[] |
flatMapToDbl(java.util.Collection<T> objects,
java.util.function.Function<T,double[]> function)
Given a collection of objects of type <T>, and a
Function<T, double[]>, returns an array
of primitive doubles. |
static <T> double[] |
flatMapToDblDistinct(java.util.Collection<T> objects,
java.util.function.Function<T,double[]> function)
Given a collection of objects of type <T>, and a
Function<T, double[]>, returns an array
of distinct primitive doubles. |
public static double[] dblUnaryTransform(double[] doubles,
java.util.function.DoubleUnaryOperator operator)
DoubleUnaryOperator that transforms each of those doubles to
another double, returns an array of the resulting double values.doubles - An array of doubles to be transformed.operator - A DoubleUnaryOperator that takes a double and transforms it to another double.public static double[] dblUnaryTransformDistinct(double[] doubles,
java.util.function.DoubleUnaryOperator operator)
DoubleUnaryOperator that transforms each of those doubles to
another double, returns an array of the resulting double values, which will contain only distinct
values.doubles - An array of doubles to be transformed.operator - A DoubleUnaryOperator that takes a double and transforms it to another double.public static <R> java.util.List<R> dblTransform(double[] doubles,
java.util.function.DoubleFunction<R> transformer)
DoubleFunction<R> that transforms those doubles into elements
of type <R>, returns a List<R> of those elements.R - The type of the elements in the resulting List.doubles - An array of doubles to be transformed.transformer - A DoubleFunction<R> that takes a double and transforms it to an element of type
<R>.public static <R> java.util.Set<R> dblTransformToSet(double[] doubles,
java.util.function.DoubleFunction<R> transformer)
DoubleFunction<R> that transforms those doubles to an element
of type <R>, returns a Set<R> of those elements.R - The type of the elements in the resulting Set.doubles - An array of doubles to be transformed.transformer - A DoubleFunction<R> that takes a double and transforms it to an element of type
<R>.public static <C extends java.util.Collection<java.lang.Double>> C dblTransform(double[] doubles,
java.util.stream.Collector<java.lang.Double,?,C> collector)
Collector<Double, ?, C>, returns a
Collection<C> of Double elements.C - The type of the collection of Double values returned.doubles - An array of doubles to be collected.collector - A Collector<Double, ?, C> that appends Double values into a collection of type <C>.public static <R> java.util.List<R> dblTransformDistinct(double[] doubles,
java.util.function.DoubleFunction<R> transformer)
DoubleFunction<R> that transforms those doubles to elements
of type <R>, returns a List<R> of those elements, which will contain only unique values
(according to Object.equals(Object)).R - The type of the elements in the resulting List.doubles - An array of doubles to be transformed.transformer - A DoubleFunction<R> that takes a double and transforms it to an element of type
<R>.public static <U,C extends java.util.Collection<U>> C dblTransform(double[] doubles,
org.perro.functions.mapper.DblTransformerCollector<U,C> transformerCollector)
DblTransformerCollector<U, C> that contains a
DoubleFunction<U> to transform double values into elements of type <U>, and a
Collector<U, ?, C>, returns a collection of type <C> of those elements. The
transformerCollection passed into this method should be created via a call to
dblTransformAndThen(DoubleFunction, Collector).U - The type of the elements in the resulting Collection.C - The type of the Collection of elements of type <U> returned.doubles - An array of doubles to be transformed.transformerCollector - A object containing a transformer DoubleFunction<U> to transform double values
into elements of type <U>, and a Collector<U, ?, C> to put those elements
into a resulting collection.public static double[] dblFlatMap(double[] doubles,
java.util.function.DoubleFunction<double[]> function)
DoubleFunction<double[]> (a function that takes a double and
returns an array of doubles), returns an array of doubles.doubles - An array of primitive doubles to be flat-mapped into another array of doubles.function - A DoubleFunction that takes a double and returns an array of doubles.public static double[] dblFlatMapDistinct(double[] doubles,
java.util.function.DoubleFunction<double[]> function)
DoubleFunction<double[]> (a function that takes a double and
returns an array of doubles), returns an array of distinct primitive double values.doubles - An array of primitive doubles to be flat-mapped into another array of doubles.function - A DoubleFunction that takes a double and returns an array of doubles.public static <T> double[] flatMapToDbl(java.util.Collection<T> objects,
java.util.function.Function<T,double[]> function)
Function<T, double[]>, returns an array
of primitive doubles.T - The type of the elements in the given objects collection.objects - A collection of objects of type <T>, to be flat-mapped into an array of primitive doubles.function - A Function that takes an element of type <T> and returns a primitive double array.public static <T> double[] flatMapToDblDistinct(java.util.Collection<T> objects,
java.util.function.Function<T,double[]> function)
Function<T, double[]>, returns an array
of distinct primitive doubles.T - The type of the elements in the given objects collection.objects - A collection of objects of type <T>, to be flat-mapped into an array of primitive doubles.function - A Function that takes an element of type <T> and returns a primitive double array.public static <U,C extends java.util.Collection<U>> org.perro.functions.mapper.DblTransformerCollector<U,C> dblTransformAndThen(java.util.function.DoubleFunction<U> transformer,
java.util.stream.Collector<U,?,C> collector)
DblTransformerCollector<U, C> that contains a DoubleFunction<U> to
transform primitive double values into elements of type <U>, and a Collector<U, ?, C> to
collect those elements into a collection of type <C>. Used to build the second parameter to
dblTransform(double[], DblTransformerCollector).U - The type of the elements into which double values are to be transformed.C - The type of a collection of elements of type <U>, into which a given collector will
append elements.transformer - A DoubleFunction<U> to transform primitive double values into elements of
type <U>.collector - A Collector<U, ?, C> to append elements into a collection of type <C>.DoubleFunction<U> to transform primitive double values into
elements of type <U>, and a Collector<U, ?, C> to append those elements into a
collection of type <C>.public static <K,V> java.util.Map<K,V> dblTransformToMap(double[] doubles,
org.perro.functions.mapper.DblKeyValueMapper<K,V> keyValueMapper)
DblKeyValueMapper containing a
DoubleFunction to transform a double to a key of type <K>, and another
DoubleFunction to transform a double to a value of type <V>, returns a
Map<K, V>.K - The type of the key of the resulting Map<K, V>.V - The type of the value of the resulting Map<K, V>.doubles - An array of primitive doubles to be transformed into keys and values for the resulting
Map<K, V>.keyValueMapper - An object containing a DoubleFunction to transform a double to a key of type <K>,
and another DoubleFunction to transform a double to a value of type <V>.