public final class DblMapperUtils
extends java.lang.Object
double types.| Modifier and Type | Method and Description |
|---|---|
static java.util.function.DoubleUnaryOperator |
dblAdd(double toAdd)
Builds a
DoubleUnaryOperator that adds a constant value to a double parameter. |
static java.util.function.DoubleUnaryOperator |
dblDivide(double divisor)
Builds a
DoubleUnaryOperator that divides its double parameter by a constant value. |
static java.util.function.DoubleFunction<java.util.stream.DoubleStream> |
dblFlatMapper(java.util.function.DoubleFunction<? extends double[]> doubleMapper)
Given a
DoubleFunction that returns a double array, this method builds a
DoubleFunction that returns a DoubleStream. |
static <K,V> org.perro.functions.mapper.DblKeyValueMapper<K,V> |
dblKeyValueMapper(java.util.function.DoubleFunction<K> keyMapper,
java.util.function.DoubleFunction<V> valueMapper)
Builds an object representing a pair of double functions, one to return a key in a
Map, and the
other to return its associated value. |
static <U,R> java.util.function.DoubleFunction<R> |
dblMapper(java.util.function.BiFunction<java.lang.Double,? super U,? extends R> biFunction,
U value)
Builds a
DoubleFunction from a passed BiFunction. |
static <R> java.util.function.DoubleFunction<R> |
dblMapper(java.util.function.DoubleFunction<R> function)
Simply casts a method reference, which takes a single parameter of type
double and returns
<R>, to a DoubleFunction. |
static java.util.function.DoubleUnaryOperator |
dblModulo(double divisor)
Builds a
DoubleUnaryOperator that divides its double parameter by a constant value to
get a remainder. |
static java.util.function.DoubleUnaryOperator |
dblMultiply(double factor)
Builds a
DoubleUnaryOperator that multiplies a constant value with a double parameter. |
static <U,V> java.util.function.DoubleFunction<Pair<U,V>> |
dblPairOf(org.perro.functions.mapper.DblKeyValueMapper<U,V> keyValueMapper)
Given an object consisting of a pair of double functions, one that returns a value of type <U>, and the
other that returns a value of type <V>, this method builds a
DoubleFunction that returns a
value of type Pair<U, V>. |
static <U> java.util.function.DoubleFunction<DoubleObjectPair<U>> |
dblPairOf(java.util.function.DoubleFunction<? extends U> rightFunction)
Given a
DoubleFunction that returns a value of type <U>, this method builds a
DoubleFunction that returns a value of type DoubleObjectPair<U>. |
static <U,V> java.util.function.DoubleFunction<Pair<U,V>> |
dblPairOf(java.util.function.DoubleFunction<? extends U> leftFunction,
java.util.function.DoubleFunction<? extends V> rightFunction)
Given a pair of double functions, one that returns a value of type <U>, and the other that returns a value
of type <V>, this method builds a
DoubleFunction that returns a value of type
Pair<U, V>. |
static <U,V> java.util.function.DoubleFunction<Pair<U,V>> |
dblPairWith(java.util.function.DoubleFunction<? extends U> function,
java.util.List<V> pairedList)
Given a
DoubleFunction<U>, and a List<V>, this method builds a
DoubleFunction that returns a Pair<U, V>. |
static <R> java.util.function.DoubleFunction<DoubleObjectPair<R>> |
dblPairWith(java.util.List<R> pairedList)
Given a
List<R>, this methods builds a DoubleFunction that returns a
DoubleObjectPair<R>. |
static java.util.function.DoubleFunction<DoubleIndexPair> |
dblPairWithIndex()
Builds a
DoubleFunction that returns an object that represents a pair of values, one being the
double value itself, and the other a primitive zero-based index of the double in encounter order. |
static <R> java.util.function.DoubleFunction<Pair<R,java.lang.Integer>> |
dblPairWithIndex(java.util.function.DoubleFunction<? extends R> function)
Given a
DoubleFunction that returns a value of type <R>, this method builds a
DoubleFunction that returns an object that represents a pair of values, one being a value returned
from the passed double function, and the other a primitive zero-based index of the double value in
encounter order. |
static java.util.function.DoubleUnaryOperator |
dblSubtract(double toSubtract)
Builds a
DoubleUnaryOperator that subtracts a constant value from a double parameter. |
static <R> java.util.function.DoubleFunction<R> |
dblTernary(java.util.function.DoublePredicate predicate,
org.perro.functions.mapper.DoubleTernaryMapper<R> trueFalseMappers)
Given a DoublePredicate and an object consisting of a pair of double functions, each returning a value of type
<R>, one to return a value if the predicate is true, the other returning an alternate value if the
predicate is false, this method builds a
DoubleFunction that evaluates the predicate and returns a
value produced by one or the other of the pair. |
static <R> org.perro.functions.mapper.DoubleTernaryMapper<R> |
dblTrueFalseMappers(java.util.function.DoubleFunction<R> trueExtractor,
java.util.function.DoubleFunction<R> falseExtractor)
Builds an object representing a pair of functions, one to return a value if a double predicate evaluates to true,
the other to return an alternate value if it evaluates to false.
|
static <T> java.util.function.Function<T,java.util.stream.DoubleStream> |
flatMapperToDbl(java.util.function.Function<? super T,? extends double[]> toDoubleArrayMapper)
Given a
Function that takes an argument of type <T> and returns a double array,
this method builds a Function that takes the same argument, but returns a DoubleStream. |
static <U,R> java.util.function.DoubleFunction<R> |
inverseDblMapper(java.util.function.BiFunction<? super U,java.lang.Double,? extends R> biFunction,
U value)
Builds a
DoubleFunction from a passed BiFunction. |
static <T,U> java.util.function.ToDoubleFunction<T> |
inverseToDblMapper(java.util.function.ToDoubleBiFunction<? super U,? super T> biFunction,
U value)
Builds a
ToDoubleFunction from a passed ToDoubleBiFunction. |
static <T,U> java.util.function.ToDoubleFunction<T> |
toDblMapper(java.util.function.ToDoubleBiFunction<? super T,? super U> biFunction,
U value)
Builds a
ToDoubleFunction from a passed ToDoubleBiFunction. |
static <T> java.util.function.ToDoubleFunction<T> |
toDblMapper(java.util.function.ToDoubleFunction<T> function)
Simply casts a method reference, which takes a single parameter of type <T> and returns
double,
to a ToDoubleFunction. |
static <T> java.util.function.ToDoubleFunction<T> |
toDblMapperDefault(java.util.function.ToDoubleFunction<? super T> function,
double defaultValue)
Builds a mapper
ToDoubleFunction that, if the target element is null, or the result of
the Function call on the target element is null, then the passed default value is
returned. |
public static <R> java.util.function.DoubleFunction<R> dblMapper(java.util.function.DoubleFunction<R> function)
double and returns
<R>, to a DoubleFunction. Everything said about the MapperUtils.mapper(Function)
method applies here. The difference is that instead of an element of type <T> being streamed through, it
would be a primitive double instead. This method might be useful in a situation where you have a
DoubleStream, and the DoubleStream.mapToObj(DoubleFunction mapper) method is called to
convert the primitive to some generic type of object, converting the DoubleStream to an object
stream.
Note that the difference between this method and toDblMapper(ToDoubleFunction) is that the
DoubleFunction built from this method takes a double and returns a generic type, where
the ToDoubleFunction built from toDblMapper(ToDoubleFunction) takes a generic type and
returns a double.
R - The type of the result of the DoubleFunction built by this method.function - A method reference to be cast to a DoubleFunction.public static <U,R> java.util.function.DoubleFunction<R> dblMapper(java.util.function.BiFunction<java.lang.Double,? super U,? extends R> biFunction,
U value)
DoubleFunction from a passed BiFunction. Everything said about the
MapperUtils.mapper(BiFunction, Object) method applies here. The difference is that instead of an element
of type <T> being streamed through, it would be a primitive double instead. This method might
be useful in a situation where you have a DoubleStream, and the
DoubleStream.mapToObj(DoubleFunction mapper) method is called to convert the primitive to some
generic type of object, converting the DoubleStream to an object stream.
Note that the difference between this method and toDblMapper(ToDoubleBiFunction, Object) is that the
DoubleFunction built from this method takes a double and returns a generic type, where
the ToDoubleFunction built from toDblMapper(ToDoubleBiFunction, Object) takes a generic
type and returns a double.
U - The type of the constant value to be passed as the second parameter to each invocation of
biFunction.R - The type of the result of the DoubleFunction built by this method.biFunction - A method reference which is a BiFunction, taking two parameters - the first of type double, and
the second of type <U>, which can be any type. The method reference will be converted by
this method to a DoubleFunction, taking a single parameter of type double. Behind the scenes,
this BiFunction will be called, passing the constant value to each invocation as the second
parameter.value - A constant value, in that it will be passed to every invocation of the passed biFunction as the
second parameter to it, and will have the same value for each of them.public static <U,R> java.util.function.DoubleFunction<R> inverseDblMapper(java.util.function.BiFunction<? super U,java.lang.Double,? extends R> biFunction,
U value)
DoubleFunction from a passed BiFunction. Everything said about the
MapperUtils.inverseMapper(BiFunction, Object) method applies here. The difference is that instead of an
element of type <T> being streamed through, it would be a primitive double instead. This
method might be useful in a situation where you have a DoubleStream, and the
DoubleStream.mapToObj(DoubleFunction mapper) method is called to convert the primitive to some
generic type of object, converting the DoubleStream to an object stream.
Note that the difference between this method and inverseToDblMapper(ToDoubleBiFunction, Object) is
that the DoubleFunction built from this method takes a double and returns a generic
type, where the ToDoubleFunction built from inverseToDblMapper(ToDoubleBiFunction, Object)
takes a generic type and returns a double.
U - The type of the constant value to be passed as the first parameter to each invocation of
biFunction.R - The type of the result of the DoubleFunction built by this method.biFunction - A method reference which is a BiFunction, taking two parameters - the first of type <U>
which can be any type, and the second of type double. The method reference will be converted by
this method to a DoubleFunction, taking a single parameter of type double. Behind the scenes,
this biFunction will be called, passing the constant value to each invocation as the first
parameter.value - A constant value, in that it will be passed to every invocation of the passed biFunction as the
first parameter to it, and will have the same value for each of them.public static <T> java.util.function.ToDoubleFunction<T> toDblMapper(java.util.function.ToDoubleFunction<T> function)
double,
to a ToDoubleFunction. Everything said about the MapperUtils.mapper(Function) method applies
here. The difference is that instead of returning a result of a generic object type, it returns a primitive
double instead. This method might be useful in a situation where you have a Stream of a
generic object type, and the mapToDouble(ToDoubleFunction mapper) method is called to convert the
object to a primitive double, converting the stream to a DoubleStream.
Note that the difference between this method and dblMapper(DoubleFunction) is that the
ToDoubleFunction built from this method takes a generic type and returns a double,
where the DoubleFunction built from dblMapper(DoubleFunction) takes a
double and returns a generic type.
T - The type of the single parameter to the ToDoubleFunction.function - A method reference to be cast to a ToDoubleFunction.public static <T> java.util.function.ToDoubleFunction<T> toDblMapperDefault(java.util.function.ToDoubleFunction<? super T> function,
double defaultValue)
ToDoubleFunction that, if the target element is null, or the result of
the Function call on the target element is null, then the passed default value is
returned. Everything said about the MapperUtils.mapperDefault(Function, Object) method applies here. The
difference is that instead of returning a result of a generic object type, it returns a primitive
double instead. This method might be useful in a situation where you have a Stream of a
generic object type, and the mapToDouble(ToDoubleFunction mapper) method is called to convert the
object to a primitive double, converting the stream to a DoubleStream.T - The type of the target element on which the mapper ToDoubleFunction is to be called.function - A method reference which takes a single parameter of type <T>, and returns a value of
type double.defaultValue - A default value of type double, to be returned in case the target element, or the result of
the ToDoubleFunction call on the target element is null.public static <T,U> java.util.function.ToDoubleFunction<T> toDblMapper(java.util.function.ToDoubleBiFunction<? super T,? super U> biFunction,
U value)
ToDoubleFunction from a passed ToDoubleBiFunction. Everything said about the
MapperUtils.mapper(BiFunction, Object) method applies here. The difference is that instead of returning a
result of a generic object type, it returns a primitive double instead. This method might be useful
in a situation where you have a Stream of a generic object type, and the
mapToDouble(ToDoubleFunction mapper) method is called to convert the object to a primitive
double, converting the stream to a DoubleStream.
Note that the difference between this method and dblMapper(BiFunction, Object) is that the
ToDoubleFunction built from this method takes a generic type and returns a double,
where the DoubleFunction built from dblMapper(BiFunction, Object) takes a
double and returns a generic type.
T - The type of the target element on which the mapper ToDoubleFunction is to be called.U - The type of the constant value to be passed as the second parameter to each invocation of
biFunction.biFunction - A method reference which is a ToDoubleBiFunction, taking two parameters - the first of type
<T>, and the second of type <U>, both of which can be any type. The method
reference will be converted by this method to a ToDoubleFunction, taking a single parameter of
type <T>. Behind the scenes, this ToDoubleBiFunction will be called, passing the constant
value to each invocation as the second parameter.value - A constant value, in that it will be passed to every invocation of the passed biFunction as the
second parameter to it, and will have the same value for each of them.public static <T,U> java.util.function.ToDoubleFunction<T> inverseToDblMapper(java.util.function.ToDoubleBiFunction<? super U,? super T> biFunction,
U value)
ToDoubleFunction from a passed ToDoubleBiFunction. Everything said about the
MapperUtils.inverseMapper(BiFunction, Object) method applies here. The difference is that instead of
returning a result of a generic object type, it returns a primitive double instead. This method
might be useful in a situation where you have a Stream of a generic object type, and the
mapToDouble(ToDoubleFunction mapper) method is called to convert the object to a primitive
double, converting the stream to a DoubleStream.
Note that the difference between this method and inverseDblMapper(BiFunction, Object) is
that the ToDoubleFunction built from this method takes a generic type and returns a
double, where the DoubleFunction built from
inverseDblMapper(BiFunction, Object) takes a double and returns a generic type.
T - The type of the target element on which the mapper ToDoubleFunction is to be called.U - The type of the constant value to be passed as the first parameter to each invocation of
biFunction.biFunction - A method reference which is a ToDoubleBiFunction, taking two parameters - the first of type
<U> which can be any type, and the second of type double. The method reference will be
converted by this method to a ToDoubleFunction, taking a single parameter of type <T>.
Behind the scenes, this biFunction will be called, passing the constant value to each
invocation as the first parameter.value - A constant value, in that it will be passed to every invocation of the passed biFunction as the
first parameter to it, and will have the same value for each of them.public static java.util.function.DoubleFunction<java.util.stream.DoubleStream> dblFlatMapper(java.util.function.DoubleFunction<? extends double[]> doubleMapper)
DoubleFunction that returns a double array, this method builds a
DoubleFunction that returns a DoubleStream. This is useful in the
DoubleStream.flatMap() method. For a very contrived example, let's say you have a method,
MathUtils.getFactors(double product), that takes a double value, truncating the decimal portion,
and returns a double array containing the factors of that number. You have lower and upper bound int
values to create a range, which is converted to a DoubleStream, and you want to sum the factors of
all of the individual double values:
private double getSumOfAllFactors(int startInclusive, int endExclusive) {
return IntStream.range(startInclusive, endExclusive).asDoubleStream()
.flatMap(DblMapperUtils.dblFlatMapper(MathUtils::getFactors))
.sum();
}
Or, with static imports:
private double getSumOfAllFactors(int startInclusive, int endExclusive) {
return IntStream.range(startInclusive, endExclusive).asDoubleStream()
.flatMap(dblFlatMapper(MathUtils::getFactors))
.sum();
}
doubleMapper - A DoubleFunction that returns an array of doubles.public static <T> java.util.function.Function<T,java.util.stream.DoubleStream> flatMapperToDbl(java.util.function.Function<? super T,? extends double[]> toDoubleArrayMapper)
Function that takes an argument of type <T> and returns a double array,
this method builds a Function that takes the same argument, but returns a DoubleStream.
This is useful in the Stream.flatMapToDouble() method. For example, let's say you have a collection
of objects representing the product lines of your company. You want to total the prices of all products in those
product lines contained in the collection:
private double getTotalProductLinePrices(Collection<ProductLine> productLines) {
return productLines.stream()
.flatMapToDouble(DblMapperUtils.flatMapperToDbl(this::getAllPrices))
.sum();
}
private double[] getAllPrices(ProductLine productLine) {
...
}
Or, with static imports:
private double getTotalProductLinePrices(Collection<ProductLine> productLines) {
return productLines.stream()
.flatMapToDouble(flatMapperToDbl(this::getAllPrices))
.sum();
}
T - The type of the argument to be passed to the given toDoubleArrayMapper function.toDoubleArrayMapper - A Function taking an argument of type <T>, that returns an array of doubles.public static <U> java.util.function.DoubleFunction<DoubleObjectPair<U>> dblPairOf(java.util.function.DoubleFunction<? extends U> rightFunction)
DoubleFunction that returns a value of type <U>, this method builds a
DoubleFunction that returns a value of type DoubleObjectPair<U>. This pair will
consist of the target double itself, and a value returned by the passed rightFunction.U - The type of the right element of the DoubleObjectPair to be returned by the DoubleFunction
built by this method.rightFunction - A DoubleFunction to extract the right value in the DoubleObjectPair<U> to be returned
by the DoubleFunction built by this method.public static <U,V> java.util.function.DoubleFunction<Pair<U,V>> dblPairOf(org.perro.functions.mapper.DblKeyValueMapper<U,V> keyValueMapper)
DoubleFunction that returns a
value of type Pair<U, V>. This pair will consist of the values returned by each of the
functions in the passed keyValueMapper. This method does the same thing as the overload that takes a
leftFunction and rightFunction, and is included as a convenience when a method already
takes a DblKeyValueMapper. For example, the implementation of the
DblTransformUtils.dblTransformToMap(double[], DblKeyValueMapper) method is:
public static <K, V> Map<K, V> dblTransformToMap(double[] doubles, DblKeyValueMapper<K, V> keyValueMapper) {
return defaultDblStream(doubles)
.mapToObj(dblPairOf(keyValueMapper))
.collect(toMapFromEntry());
}
This works because the Pair object implements the Java Map.Entry interface.U - The type of the left element of the Pair to be returned by the DoubleFunction built by this
method.V - The type of the right element of the Pair to be returned by the DoubleFunction built by
this method.keyValueMapper - An object consisting of a pair of double functions that will be used to retrieve a left and
right value for a Pair that is a result of the DoubleFunction built by this method.public static <U,V> java.util.function.DoubleFunction<Pair<U,V>> dblPairOf(java.util.function.DoubleFunction<? extends U> leftFunction, java.util.function.DoubleFunction<? extends V> rightFunction)
DoubleFunction that returns a value of type
Pair<U, V>. This pair will consist of the values returned by each of the double functions
passed to this method.U - The type of the left element of the Pair to be returned by the DoubleFunction built by this
method.V - The type of the right element of the Pair to be returned by the DoubleFunction built by this
method.leftFunction - A DoubleFunction that will be used to retrieve a left value for a Pair that is a result of
the DoubleFunction built by this method.rightFunction - A DoubleFunction that will be used to retrieve a right value for a Pair that is a result of
the DoubleFunction built by this method.public static <R> java.util.function.DoubleFunction<DoubleObjectPair<R>> dblPairWith(java.util.List<R> pairedList)
List<R>, this methods builds a DoubleFunction that returns a
DoubleObjectPair<R>. It is intended to be used in a stream. The
DoubleObjectPair<R> built by this DoubleFunction will consist of a target
double, and an object of type <R> whose element in the passed List is associated with the
current double, in encounter order. The function returned from this method is not intended to be used with
parallel streams.
If the passed List has more elements than the array of doubles being streamed, the extra elements
are ignored. If it has fewer elements, any target values that do not have associated values in the list, will be
paired with a null value.
R - The type of the elements in the passed pairedList parameter.pairedList - A List whose elements are to be paired with double array elements being streamed, by the
DoubleFunction built by this method.public static <U,V> java.util.function.DoubleFunction<Pair<U,V>> dblPairWith(java.util.function.DoubleFunction<? extends U> function, java.util.List<V> pairedList)
DoubleFunction<U>, and a List<V>, this method builds a
DoubleFunction that returns a Pair<U, V>. It is intended to be used in a stream.
The Pair<U, V> built by this DoubleFunction will consist of an element returned
by the passed function, and an object of type <V> whose element in the passed
List is associated with the current double, in encounter order. The double function returned from
this method is not intended to be used with parallel streams.
If the passed List has more elements than the double array being streamed, the extra elements are
ignored. If it has fewer elements, any values returned by the passed double function, that do not
have associated values in the list, will be paired with a null value.
U - The type of the left element, retrieved by the passed function.V - The type of the right element, retrieved from the passed List.function - A DoubleFunction that will return a value of type <U>, which will become the left element
in a Pair, returned by the DoubleFunction built by this method.pairedList - A List whose elements are to be paired with elements retrieved by the passed double function.public static java.util.function.DoubleFunction<DoubleIndexPair> dblPairWithIndex()
DoubleFunction that returns an object that represents a pair of values, one being the
double value itself, and the other a primitive zero-based index of the double in encounter order. The
DoubleFunction built by this method is intended to be used in a stream, but is not intended
to be used with parallel streams.public static <R> java.util.function.DoubleFunction<Pair<R,java.lang.Integer>> dblPairWithIndex(java.util.function.DoubleFunction<? extends R> function)
DoubleFunction that returns a value of type <R>, this method builds a
DoubleFunction that returns an object that represents a pair of values, one being a value returned
from the passed double function, and the other a primitive zero-based index of the double value in
encounter order. The DoubleFunction built by this method is intended to be used in a stream, but is
not intended to be used with parallel streams.R - The type of a value retrieved from the passed double function.function - A DoubleFunction that returns a value of type <R>.public static <R> java.util.function.DoubleFunction<R> dblTernary(java.util.function.DoublePredicate predicate,
org.perro.functions.mapper.DoubleTernaryMapper<R> trueFalseMappers)
DoubleFunction that evaluates the predicate and returns a
value produced by one or the other of the pair. It may be difficult to think of an example where this may be
useful, but this method is included here for the sake of completeness.R - The type of the values returned by the pair of double functions in the passed
trueFalseMappers.predicate - A double predicate to be evaluated, determining which of the pair of double functions
below will return a resulting value.trueFalseMappers - An object consisting of a pair of double functions, one to return a value if the passed
predicate evaluates to true, and the other to return an alternate value if it evaluates
to false.public static <R> org.perro.functions.mapper.DoubleTernaryMapper<R> dblTrueFalseMappers(java.util.function.DoubleFunction<R> trueExtractor,
java.util.function.DoubleFunction<R> falseExtractor)
dblTernary(DoublePredicate, DoubleTernaryMapper) method.R - The type of the value to be returned by the extractor methods below.trueExtractor - Retrieves a value to be returned by the
dblTernary(DoublePredicate, DoubleTernaryMapper) method when its predicate
evaluates to true.falseExtractor - Retrieves a value to be returned by the
dblTernary(DoublePredicate, DoubleTernaryMapper) method when its predicate
evaluates to false.public static <K,V> org.perro.functions.mapper.DblKeyValueMapper<K,V> dblKeyValueMapper(java.util.function.DoubleFunction<K> keyMapper,
java.util.function.DoubleFunction<V> valueMapper)
Map, and the
other to return its associated value. This method is meant to be used to build the second parameter to the
DblTransformUtils.dblTransformToMap(double[], DblKeyValueMapper) method.K - The type of a key value for a Map.V - The type of a value to be associated with a key in a Map.keyMapper - DoubleFunction to retrieve a value to be used as a key in a Map.valueMapper - DoubleFunction to retrieve a value associated with a key in a Map.public static java.util.function.DoubleUnaryOperator dblAdd(double toAdd)
DoubleUnaryOperator that adds a constant value to a double parameter.toAdd - A constant double value to be added to the parameter of a DoubleUnaryOperator.public static java.util.function.DoubleUnaryOperator dblSubtract(double toSubtract)
DoubleUnaryOperator that subtracts a constant value from a double parameter.toSubtract - A constant double value to be subtracted from the parameter of a DoubleUnaryOperator.public static java.util.function.DoubleUnaryOperator dblMultiply(double factor)
DoubleUnaryOperator that multiplies a constant value with a double parameter.factor - A constant double value to be multiplied with the parameter of a DoubleUnaryOperator.public static java.util.function.DoubleUnaryOperator dblDivide(double divisor)
DoubleUnaryOperator that divides its double parameter by a constant value.divisor - A constant double value to be divided into the parameter of a DoubleUnaryOperator.public static java.util.function.DoubleUnaryOperator dblModulo(double divisor)
DoubleUnaryOperator that divides its double parameter by a constant value to
get a remainder.divisor - A constant double value to be divided into the parameter of a DoubleUnaryOperator to get a
remainder.