Example usage for java.util.function DoubleToIntFunction applyAsInt

List of usage examples for java.util.function DoubleToIntFunction applyAsInt

Introduction

In this page you can find the example usage for java.util.function DoubleToIntFunction applyAsInt.

Prototype

int applyAsInt(double value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleToIntFunction df = (x) -> {
        return (int) x + 2;
    };//  w ww. j a v a2  s .c  o  m

    System.out.println(df.applyAsInt(3.14));
}

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

/**
 * Creates a {@link BiDoubleToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link DoubleToIntFunction}.//from   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 BiDoubleToIntFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code DoubleToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static BiDoubleToIntFunction onlyFirst(@Nonnull final DoubleToIntFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2) -> function.applyAsInt(value1);
}

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

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

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

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

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

/**
 * Creates a {@link TriDoubleToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link DoubleToIntFunction}./*from   www .j a  va  2s . c  o m*/
 *
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code TriDoubleToIntFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code DoubleToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static TriDoubleToIntFunction onlyFirst(@Nonnull final DoubleToIntFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.applyAsInt(value1);
}

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

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

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

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

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

/**
 * Creates a {@link ObjBiDoubleToIntFunction} which uses the {@code second} parameter of this one as argument for
 * the given {@link DoubleToIntFunction}.
 *
 * @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 ObjBiDoubleToIntFunction} which uses the {@code second} parameter of this one as
 * argument for the given {@code DoubleToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 *//* ww w . jav a2 s .  c  om*/
@Nonnull
static <T> ObjBiDoubleToIntFunction<T> onlySecond(@Nonnull final DoubleToIntFunction function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsInt(value1);
}

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

/**
 * Creates a {@link ObjBiDoubleToIntFunction} which uses the {@code third} parameter of this one as argument for the
 * given {@link DoubleToIntFunction}./*from ww  w .j  av a2 s .c  om*/
 *
 * @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 ObjBiDoubleToIntFunction} which uses the {@code third} parameter of this one as argument
 * for the given {@code DoubleToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiDoubleToIntFunction<T> onlyThird(@Nonnull final DoubleToIntFunction function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsInt(value2);
}

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

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