Example usage for java.util.function ToLongFunction applyAsLong

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

Introduction

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

Prototype

long applyAsLong(T value);

Source Link

Document

Applies this function to the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    ToLongFunction<String> i = (x) -> Long.parseLong(x);

    System.out.println(i.applyAsLong("2"));
}

From source file:at.gridtec.lambda4j.function.bi.to.ToLongBiFunction2.java

/**
 * Creates a {@link ToLongBiFunction2} which uses the {@code first} parameter of this one as argument for the given
 * {@link ToLongFunction}./*from   ww w .  j  av  a 2 s .  c  om*/
 *
 * @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 first} parameter of this one
 * @return Creates a {@code ToLongBiFunction2} which uses the {@code first} parameter of this one as argument for
 * the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> ToLongBiFunction2<T, U> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, u) -> function.applyAsLong(t);
}

From source file:at.gridtec.lambda4j.function.bi.to.ToLongBiFunction2.java

/**
 * Creates a {@link ToLongBiFunction2} which uses the {@code second} parameter of this one as argument for the given
 * {@link ToLongFunction}.// w w  w .  ja  v  a2  s  .  co  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 second} parameter of this one
 * @return Creates a {@code ToLongBiFunction2} which uses the {@code second} parameter of this one as argument for
 * the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> ToLongBiFunction2<T, U> onlySecond(@Nonnull final ToLongFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u) -> function.applyAsLong(u);
}

From source file:at.gridtec.lambda4j.function.tri.to.ToLongTriFunction.java

/**
 * Creates a {@link ToLongTriFunction} which uses the {@code first} parameter of this one as argument for the given
 * {@link ToLongFunction}.//from www .  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 <V> The type of the third argument to the function
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code ToLongTriFunction} which uses the {@code first} parameter of this one as argument for
 * the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U, V> ToLongTriFunction<T, U, V> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, u, v) -> function.applyAsLong(t);
}

From source file:at.gridtec.lambda4j.function.tri.to.ToLongTriFunction.java

/**
 * Creates a {@link ToLongTriFunction} which uses the {@code second} parameter of this one as argument for the given
 * {@link ToLongFunction}.//from ww  w  . jav 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 <V> The type of the third argument to the function
 * @param function The function which accepts the {@code second} parameter of this one
 * @return Creates a {@code ToLongTriFunction} which uses the {@code second} parameter of this one as argument for
 * the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U, V> ToLongTriFunction<T, U, V> onlySecond(@Nonnull final ToLongFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u, v) -> function.applyAsLong(u);
}

From source file:at.gridtec.lambda4j.function.tri.to.ToLongTriFunction.java

/**
 * Creates a {@link ToLongTriFunction} which uses the {@code third} parameter of this one as argument for the given
 * {@link ToLongFunction}.//  w w w  .j a va 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 <V> The type of the third argument to the function
 * @param function The function which accepts the {@code third} parameter of this one
 * @return Creates a {@code ToLongTriFunction} which uses the {@code third} parameter of this one as argument for
 * the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U, V> ToLongTriFunction<T, U, V> onlyThird(@Nonnull final ToLongFunction<? super V> function) {
    Objects.requireNonNull(function);
    return (t, u, v) -> function.applyAsLong(v);
}

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

/**
 * Creates a {@link ObjLongToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}.//from  w ww.ja va  2s .c o m
 *
 * @param <T> The type of the first argument to the function
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code ObjLongToLongFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjLongToLongFunction<T> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link ObjByteToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}./*from   w ww.  j  av  a2  s.  c o  m*/
 *
 * @param <T> The type of the first argument to the function
 * @param function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code ObjByteToLongFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjByteToLongFunction<T> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link ObjCharToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}.//from   w ww  .jav 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 first} parameter of this one
 * @return Creates a {@code ObjCharToLongFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjCharToLongFunction<T> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link ObjFloatToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}./*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 first} parameter of this one
 * @return Creates a {@code ObjFloatToLongFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code ToLongFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjFloatToLongFunction<T> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.applyAsLong(t);
}