Example usage for java.util.function IntToDoubleFunction applyAsDouble

List of usage examples for java.util.function IntToDoubleFunction applyAsDouble

Introduction

In this page you can find the example usage for java.util.function IntToDoubleFunction applyAsDouble.

Prototype

double applyAsDouble(int value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    IntToDoubleFunction i = (x) -> {
        return Math.sin(x);
    };//from   w  w  w. ja  va2 s  .c o  m
    System.out.println(i.applyAsDouble(2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiIntToDoubleFunction.java

/**
 * Creates a {@link BiIntToDoubleFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}./*w w  w  .j a  v a  2 s. c  om*/
 *
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code BiIntToDoubleFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static BiIntToDoubleFunction onlyFirst(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2) -> function.applyAsDouble(value1);
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiIntToDoubleFunction.java

/**
 * Creates a {@link BiIntToDoubleFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}.//from   w  ww  .  j  a va  2s  . c o  m
 *
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code BiIntToDoubleFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static BiIntToDoubleFunction onlySecond(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2) -> function.applyAsDouble(value2);
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjIntToDoubleFunction.java

/**
 * Creates a {@link ObjIntToDoubleFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}./*  w w w  . 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 second} parameter of this one
 * @return Creates a {@code ObjIntToDoubleFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjIntToDoubleFunction<T> onlySecond(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.applyAsDouble(value);
}

From source file:at.gridtec.lambda4j.function.tri.conversion.TriIntToDoubleFunction.java

/**
 * Creates a {@link TriIntToDoubleFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}.//w  w  w  . j a v  a 2  s  .co  m
 *
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code TriIntToDoubleFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static TriIntToDoubleFunction onlyFirst(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.applyAsDouble(value1);
}

From source file:at.gridtec.lambda4j.function.tri.conversion.TriIntToDoubleFunction.java

/**
 * Creates a {@link TriIntToDoubleFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}./*from   w w  w . java  2 s  .  c o  m*/
 *
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code TriIntToDoubleFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static TriIntToDoubleFunction onlySecond(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.applyAsDouble(value2);
}

From source file:at.gridtec.lambda4j.function.tri.conversion.TriIntToDoubleFunction.java

/**
 * Creates a {@link TriIntToDoubleFunction} which uses the {@code third} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}.//  ww w.  j  a  v a 2s  .c  o  m
 *
 * @param function The function which accepts the {@code third} parameter of this one
 * @return Creates a {@code TriIntToDoubleFunction} which uses the {@code third} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static TriIntToDoubleFunction onlyThird(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.applyAsDouble(value3);
}

From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiIntToDoubleFunction.java

/**
 * Creates a {@link ObjBiIntToDoubleFunction} which uses the {@code second} parameter of this one as argument for
 * the given {@link IntToDoubleFunction}.
 *
 * @param <T> The type of the first argument to the function
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code ObjBiIntToDoubleFunction} which uses the {@code second} parameter of this one as
 * argument for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from  www .j  a  va2s  . co  m*/
@Nonnull
static <T> ObjBiIntToDoubleFunction<T> onlySecond(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsDouble(value1);
}

From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiIntToDoubleFunction.java

/**
 * Creates a {@link ObjBiIntToDoubleFunction} which uses the {@code third} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}./*from   w w w .j  a  v a2  s  .  c o  m*/
 *
 * @param <T> The type of the first argument to the function
 * @param function The function which accepts the {@code third} parameter of this one
 * @return Creates a {@code ObjBiIntToDoubleFunction} which uses the {@code third} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiIntToDoubleFunction<T> onlyThird(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsDouble(value2);
}

From source file:at.gridtec.lambda4j.function.tri.obj.BiObjIntToDoubleFunction.java

/**
 * Creates a {@link BiObjIntToDoubleFunction} which uses the {@code third} parameter of this one as argument for the
 * given {@link IntToDoubleFunction}.//  ww w. java 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 function The function which accepts the {@code third} parameter of this one
 * @return Creates a {@code BiObjIntToDoubleFunction} which uses the {@code third} parameter of this one as argument
 * for the given {@code IntToDoubleFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjIntToDoubleFunction<T, U> onlyThird(@Nonnull final IntToDoubleFunction function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsDouble(value);
}