List of usage examples for java.util.function ToDoubleFunction applyAsDouble
double applyAsDouble(T value);
From source file:Main.java
public static void main(String[] args) { ToDoubleFunction<Integer> i = (x) -> Math.sin(x); System.out.println(i.applyAsDouble(Integer.MAX_VALUE)); }
From source file:at.gridtec.lambda4j.function.bi.to.ToDoubleBiFunction2.java
/** * Creates a {@link ToDoubleBiFunction2} which uses the {@code first} parameter of this one as argument for the * given {@link ToDoubleFunction}./*w w w . ja va2s .c om*/ * * @param <T> The type of the first argument to the function * @param <U> The type of the second argument to the function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ToDoubleBiFunction2} which uses the {@code first} parameter of this one as argument for * the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, U> ToDoubleBiFunction2<T, U> onlyFirst(@Nonnull final ToDoubleFunction<? super T> function) { Objects.requireNonNull(function); return (t, u) -> function.applyAsDouble(t); }
From source file:at.gridtec.lambda4j.function.bi.to.ToDoubleBiFunction2.java
/** * Creates a {@link ToDoubleBiFunction2} which uses the {@code second} parameter of this one as argument for the * given {@link ToDoubleFunction}./*w ww .j av a2 s. com*/ * * @param <T> The type of the first argument to the function * @param <U> The type of the second argument to the function * @param function The function which accepts the {@code second} parameter of this one * @return Creates a {@code ToDoubleBiFunction2} which uses the {@code second} parameter of this one as argument for * the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, U> ToDoubleBiFunction2<T, U> onlySecond(@Nonnull final ToDoubleFunction<? super U> function) { Objects.requireNonNull(function); return (t, u) -> function.applyAsDouble(u); }
From source file:at.gridtec.lambda4j.function.tri.to.ToDoubleTriFunction.java
/** * Creates a {@link ToDoubleTriFunction} which uses the {@code first} parameter of this one as argument for the * given {@link ToDoubleFunction}./*from ww w . j a v a 2s. co m*/ * * @param <T> The type of the first argument to the function * @param <U> The type of the second argument to the function * @param <V> The type of the third argument to the function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ToDoubleTriFunction} which uses the {@code first} parameter of this one as argument for * the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, U, V> ToDoubleTriFunction<T, U, V> onlyFirst(@Nonnull final ToDoubleFunction<? super T> function) { Objects.requireNonNull(function); return (t, u, v) -> function.applyAsDouble(t); }
From source file:at.gridtec.lambda4j.function.tri.to.ToDoubleTriFunction.java
/** * Creates a {@link ToDoubleTriFunction} which uses the {@code second} parameter of this one as argument for the * given {@link ToDoubleFunction}.//from w w w . j a v a 2 s.c o m * * @param <T> The type of the first argument to the function * @param <U> The type of the second argument to the function * @param <V> The type of the third argument to the function * @param function The function which accepts the {@code second} parameter of this one * @return Creates a {@code ToDoubleTriFunction} which uses the {@code second} parameter of this one as argument for * the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, U, V> ToDoubleTriFunction<T, U, V> onlySecond(@Nonnull final ToDoubleFunction<? super U> function) { Objects.requireNonNull(function); return (t, u, v) -> function.applyAsDouble(u); }
From source file:at.gridtec.lambda4j.function.tri.to.ToDoubleTriFunction.java
/** * Creates a {@link ToDoubleTriFunction} which uses the {@code third} parameter of this one as argument for the * given {@link ToDoubleFunction}./*from w ww .j a v a 2 s. c om*/ * * @param <T> The type of the first argument to the function * @param <U> The type of the second argument to the function * @param <V> The type of the third argument to the function * @param function The function which accepts the {@code third} parameter of this one * @return Creates a {@code ToDoubleTriFunction} which uses the {@code third} parameter of this one as argument for * the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T, U, V> ToDoubleTriFunction<T, U, V> onlyThird(@Nonnull final ToDoubleFunction<? super V> function) { Objects.requireNonNull(function); return (t, u, v) -> function.applyAsDouble(v); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjDoubleToDoubleFunction.java
/** * Creates a {@link ObjDoubleToDoubleFunction} which uses the {@code first} parameter of this one as argument for * the given {@link ToDoubleFunction}.//from ww w. ja va2 s . c o m * * @param <T> The type of the first argument to the function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ObjDoubleToDoubleFunction} which uses the {@code first} parameter of this one as * argument for the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjDoubleToDoubleFunction<T> onlyFirst(@Nonnull final ToDoubleFunction<? super T> function) { Objects.requireNonNull(function); return (t, value) -> function.applyAsDouble(t); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjBooleanToDoubleFunction.java
/** * Creates a {@link ObjBooleanToDoubleFunction} which uses the {@code first} parameter of this one as argument for * the given {@link ToDoubleFunction}.//from ww w. jav a 2s. c om * * @param <T> The type of the first argument to the function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ObjBooleanToDoubleFunction} which uses the {@code first} parameter of this one as * argument for the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjBooleanToDoubleFunction<T> onlyFirst(@Nonnull final ToDoubleFunction<? super T> function) { Objects.requireNonNull(function); return (t, value) -> function.applyAsDouble(t); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjByteToDoubleFunction.java
/** * Creates a {@link ObjByteToDoubleFunction} which uses the {@code first} parameter of this one as argument for the * given {@link ToDoubleFunction}.//from ww w . j a v a 2s . com * * @param <T> The type of the first argument to the function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ObjByteToDoubleFunction} which uses the {@code first} parameter of this one as argument * for the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjByteToDoubleFunction<T> onlyFirst(@Nonnull final ToDoubleFunction<? super T> function) { Objects.requireNonNull(function); return (t, value) -> function.applyAsDouble(t); }
From source file:at.gridtec.lambda4j.function.bi.obj.ObjCharToDoubleFunction.java
/** * Creates a {@link ObjCharToDoubleFunction} which uses the {@code first} parameter of this one as argument for the * given {@link ToDoubleFunction}.// www . j a v a 2 s . c o m * * @param <T> The type of the first argument to the function * @param function The function which accepts the {@code first} parameter of this one * @return Creates a {@code ObjCharToDoubleFunction} which uses the {@code first} parameter of this one as argument * for the given {@code ToDoubleFunction}. * @throws NullPointerException If given argument is {@code null} */ @Nonnull static <T> ObjCharToDoubleFunction<T> onlyFirst(@Nonnull final ToDoubleFunction<? super T> function) { Objects.requireNonNull(function); return (t, value) -> function.applyAsDouble(t); }