Example usage for java.util.function LongFunction apply

List of usage examples for java.util.function LongFunction apply

Introduction

In this page you can find the example usage for java.util.function LongFunction apply.

Prototype

R apply(long value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    LongFunction<String> i = (l) -> Long.toString(l);

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

From source file:at.gridtec.lambda4j.function.bi.BiLongFunction.java

/**
 * Creates a {@link BiLongFunction} which uses the {@code first} parameter of this one as argument for the given
 * {@link LongFunction}./*from w ww  .  ja  v a 2s .com*/
 *
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code BiLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> BiLongFunction<R> onlyFirst(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (value1, value2) -> function.apply(value1);
}

From source file:at.gridtec.lambda4j.function.bi.BiLongFunction.java

/**
 * Creates a {@link BiLongFunction} which uses the {@code second} parameter of this one as argument for the given
 * {@link LongFunction}./*ww  w .  j a  v a2 s . c om*/
 *
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code BiLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> BiLongFunction<R> onlySecond(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (value1, value2) -> function.apply(value2);
}

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

/**
 * Creates a {@link ObjLongFunction} which uses the {@code second} parameter of this one as argument for the given
 * {@link LongFunction}.//from  w  w  w. ja v a  2  s.c  o m
 *
 * @param <T> The type of the first argument to the function
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code ObjLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, R> ObjLongFunction<T, R> onlySecond(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.apply(value);
}

From source file:at.gridtec.lambda4j.function.tri.TriLongFunction.java

/**
 * Creates a {@link TriLongFunction} which uses the {@code first} parameter of this one as argument for the given
 * {@link LongFunction}./*  w  w w .j  av  a  2 s . c o m*/
 *
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code TriLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> TriLongFunction<R> onlyFirst(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.apply(value1);
}

From source file:at.gridtec.lambda4j.function.tri.TriLongFunction.java

/**
 * Creates a {@link TriLongFunction} which uses the {@code second} parameter of this one as argument for the given
 * {@link LongFunction}.// ww w. ja  va2  s  .  c o  m
 *
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code TriLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> TriLongFunction<R> onlySecond(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.apply(value2);
}

From source file:at.gridtec.lambda4j.function.tri.TriLongFunction.java

/**
 * Creates a {@link TriLongFunction} which uses the {@code third} parameter of this one as argument for the given
 * {@link LongFunction}.//from ww w . ja  v a2  s.c o  m
 *
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code third} parameter of this one
 * @return Creates a {@code TriLongFunction} which uses the {@code third} parameter of this one as argument for the
 * given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <R> TriLongFunction<R> onlyThird(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (value1, value2, value3) -> function.apply(value3);
}

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

/**
 * Creates a {@link ObjBiLongFunction} which uses the {@code second} parameter of this one as argument for the given
 * {@link LongFunction}./*from   w ww  .  ja va 2 s  . c  om*/
 *
 * @param <T> The type of the first argument to the function
 * @param <R> The type of return value from the function
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code ObjBiLongFunction} which uses the {@code second} parameter of this one as argument for
 * the given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, R> ObjBiLongFunction<T, R> onlySecond(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.apply(value1);
}

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

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

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

/**
 * Creates a {@link BiObjLongFunction} which uses the {@code third} parameter of this one as argument for the given
 * {@link LongFunction}.//from w ww .  j a va 2  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 <R> The type of return value from the function
 * @param function The function which accepts the {@code third} parameter of this one
 * @return Creates a {@code BiObjLongFunction} which uses the {@code third} parameter of this one as argument for
 * the given {@code LongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U, R> BiObjLongFunction<T, U, R> onlyThird(@Nonnull final LongFunction<? extends R> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.apply(value);
}