Example usage for java.util.function DoubleToLongFunction applyAsLong

List of usage examples for java.util.function DoubleToLongFunction applyAsLong

Introduction

In this page you can find the example usage for java.util.function DoubleToLongFunction applyAsLong.

Prototype

long applyAsLong(double value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleToLongFunction dl = (x) -> {
        return Long.MAX_VALUE - (long) x;
    };/* w  ww . ja va  2 s.co  m*/
    System.out.println(dl.applyAsLong(3.14));
}

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

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

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

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

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

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

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

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

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

/**
 * Creates a {@link TriDoubleToLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link DoubleToLongFunction}.//from  w w w  . ja  v a2 s  .  co  m
 *
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code TriDoubleToLongFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code DoubleToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static TriDoubleToLongFunction onlySecond(@Nonnull final DoubleToLongFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.applyAsLong(value2);
}

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

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

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

/**
 * Creates a {@link ObjBiDoubleToLongFunction} which uses the {@code second} parameter of this one as argument for
 * the given {@link DoubleToLongFunction}.
 *
 * @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 ObjBiDoubleToLongFunction} which uses the {@code second} parameter of this one as
 * argument for the given {@code DoubleToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 *///from  w  ww  .ja va  2 s . com
@Nonnull
static <T> ObjBiDoubleToLongFunction<T> onlySecond(@Nonnull final DoubleToLongFunction function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsLong(value1);
}

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

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

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

/**
 * Creates a {@link BiObjDoubleToLongFunction} which uses the {@code third} parameter of this one as argument for
 * the given {@link DoubleToLongFunction}.
 *
 * @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 BiObjDoubleToLongFunction} which uses the {@code third} parameter of this one as
 * argument for the given {@code DoubleToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from  w w w .j av a 2  s .c  o m*/
@Nonnull
static <T, U> BiObjDoubleToLongFunction<T, U> onlyThird(@Nonnull final DoubleToLongFunction function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(value);
}