Example usage for java.util.function ToIntFunction applyAsInt

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

Introduction

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

Prototype

int applyAsInt(T value);

Source Link

Document

Applies this function to the given argument.

Usage

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

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

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

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

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

/**
 * Creates a {@link ObjBiDoubleToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToIntFunction}.//  w  ww .  ja v  a2  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 ObjBiDoubleToIntFunction} which uses the {@code first} parameter of this one as argument
 * for the given {@code ToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiDoubleToIntFunction<T> onlyFirst(@Nonnull final ToIntFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value1, value2) -> function.applyAsInt(t);
}

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

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

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

/**
 * Creates a {@link BiObjIntToIntFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link ToIntFunction}.//from  w ww  .  ja  va 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 BiObjIntToIntFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code ToIntFunction}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjIntToIntFunction<T, U> onlySecond(@Nonnull final ToIntFunction<? super U> function) {
    Objects.requireNonNull(function);
    return (t, u, value) -> function.applyAsInt(u);
}

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

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

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

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

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

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

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

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

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

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