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.bi.obj.ObjFloatToIntFunction.java

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

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

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

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

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

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

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

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

/**
 * Creates a {@link ObjDoubleToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToIntFunction}./*from   w w  w. j  a  v  a2 s.  com*/
 *
 * @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 ObjDoubleToIntFunction} 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> ObjDoubleToIntFunction<T> onlyFirst(@Nonnull final ToIntFunction<? super T> function) {
    Objects.requireNonNull(function);
    return (t, value) -> function.applyAsInt(t);
}

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

/**
 * Creates a {@link ObjBiIntToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToIntFunction}./* www  .  j  a v a 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 ObjBiIntToIntFunction} 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> ObjBiIntToIntFunction<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.ObjBiByteToIntFunction.java

/**
 * Creates a {@link ObjBiByteToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToIntFunction}.//from   w ww  . j ava2  s  .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 ObjBiByteToIntFunction} 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> ObjBiByteToIntFunction<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.ObjBiCharToIntFunction.java

/**
 * Creates a {@link ObjBiCharToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToIntFunction}.//from   w  w  w .ja  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 ObjBiCharToIntFunction} 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> ObjBiCharToIntFunction<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.ObjBiLongToIntFunction.java

/**
 * Creates a {@link ObjBiLongToIntFunction} which uses the {@code first} parameter of this one as argument for the
 * given {@link ToIntFunction}.//from w  w w . j  ava 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 ObjBiLongToIntFunction} 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> ObjBiLongToIntFunction<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.ObjBiFloatToIntFunction.java

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