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:at.gridtec.lambda4j.function.tri.obj.ObjBiBooleanToLongFunction.java

/**
 * Creates a {@link ObjBiBooleanToLongFunction} which uses the {@code first} parameter of this one as argument for
 * the given {@link ToLongFunction}.//from   w w  w  . ja va  2 s.co  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 ObjBiBooleanToLongFunction} 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> ObjBiBooleanToLongFunction<T> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link ObjBiDoubleToLongFunction} which uses the {@code first} parameter of this one as argument for
 * the given {@link ToLongFunction}./*from ww  w .ja v  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 ObjBiDoubleToLongFunction} 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> ObjBiDoubleToLongFunction<T> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link BiObjLongToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}.//  w w w .j  av  a2  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 first} parameter of this one
 * @return Creates a {@code BiObjLongToLongFunction} 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> BiObjLongToLongFunction<T, U> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link BiObjLongToLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link ToLongFunction}./*from ww w .  j  a  v  a  2s.  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 second} parameter of this one
 * @return Creates a {@code BiObjLongToLongFunction} 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> BiObjLongToLongFunction<T, U> onlySecond(@Nonnull final ToLongFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(u);
}

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

/**
 * Creates a {@link BiObjBooleanToLongFunction} which uses the {@code first} parameter of this one as argument for
 * the given {@link ToLongFunction}.//from  w w w.  ja  v  a 2  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 first} parameter of this one
 * @return Creates a {@code BiObjBooleanToLongFunction} 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> BiObjBooleanToLongFunction<T, U> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link BiObjBooleanToLongFunction} which uses the {@code second} parameter of this one as argument for
 * the given {@link ToLongFunction}.//  w ww . java  2  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 BiObjBooleanToLongFunction} 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> BiObjBooleanToLongFunction<T, U> onlySecond(@Nonnull final ToLongFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(u);
}

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

/**
 * Creates a {@link BiObjByteToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}./*from   www  .  ja 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 function The function which accepts the {@code first} parameter of this one
 * @return Creates a {@code BiObjByteToLongFunction} 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> BiObjByteToLongFunction<T, U> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link BiObjByteToLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link ToLongFunction}./*from   www  .  j a  v a2 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 second} parameter of this one
 * @return Creates a {@code BiObjByteToLongFunction} 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> BiObjByteToLongFunction<T, U> onlySecond(@Nonnull final ToLongFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(u);
}

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

/**
 * Creates a {@link BiObjCharToLongFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToLongFunction}./*  w ww .  j  a  va2  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 first} parameter of this one
 * @return Creates a {@code BiObjCharToLongFunction} 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> BiObjCharToLongFunction<T, U> onlyFirst(@Nonnull final ToLongFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(t);
}

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

/**
 * Creates a {@link BiObjCharToLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link ToLongFunction}.// w w  w .ja  va 2 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 BiObjCharToLongFunction} 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> BiObjCharToLongFunction<T, U> onlySecond(@Nonnull final ToLongFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsLong(u);
}