Example usage for java.util.function LongToIntFunction applyAsInt

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

Introduction

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

Prototype

int applyAsInt(long value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    LongToIntFunction i = (l) -> (int) l;

    System.out.println(i.applyAsInt(Long.MAX_VALUE));
}

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

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

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

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

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

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

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

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

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

/**
 * Creates a {@link TriLongToIntFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link LongToIntFunction}./*from w ww  .  ja  va2s.  com*/
 *
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code TriLongToIntFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code LongToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static TriLongToIntFunction onlySecond(@Nonnull final LongToIntFunction function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.applyAsInt(value2);
}

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

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

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

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

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

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

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

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