Example usage for java.util.function IntConsumer accept

List of usage examples for java.util.function IntConsumer accept

Introduction

In this page you can find the example usage for java.util.function IntConsumer accept.

Prototype

void accept(int value);

Source Link

Document

Performs this operation on the given argument.

Usage

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

/**
 * Returns a composed {@link BiObjBooleanConsumer} that fist applies this function to its input, and then consumes
 * the result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjBooleanConsumer} that first applies this function to its input, and then consumes
 * the result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from  ww w  . j a  v a2  s  .  co m*/
@Nonnull
default BiObjBooleanConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

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

/**
 * Returns a composed {@link BiObjByteConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is relayed
 * to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjByteConsumer} that first applies this function to its input, and then consumes the
 * result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from  w w  w  . j  a  v  a2 s .  c om*/
@Nonnull
default BiObjByteConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

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

/**
 * Returns a composed {@link BiObjCharConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is relayed
 * to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjCharConsumer} that first applies this function to its input, and then consumes the
 * result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//* w  w w.  j  a va2 s . co  m*/
@Nonnull
default BiObjCharConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

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

/**
 * Returns a composed {@link BiObjFloatConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is relayed
 * to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjFloatConsumer} that first applies this function to its input, and then consumes
 * the result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from w ww  .j ava2  s .c  om*/
@Nonnull
default BiObjFloatConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

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

/**
 * Returns a composed {@link BiObjShortConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is relayed
 * to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjShortConsumer} that first applies this function to its input, and then consumes
 * the result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*w  w w . j ava2  s.  c  o  m*/
@Nonnull
default BiObjShortConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

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

/**
 * Returns a composed {@link BiObjLongConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is relayed
 * to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjLongConsumer} that first applies this function to its input, and then consumes the
 * result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//* w w  w . ja v  a  2  s. co  m*/
@Nonnull
default BiObjLongConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

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

/**
 * Returns a composed {@link BiObjDoubleConsumer} that fist applies this function to its input, and then consumes
 * the result using the given {@link IntConsumer}. If evaluation of either operation throws an exception, it is
 * relayed to the caller of the composed operation.
 *
 * @param consumer The operation which consumes the result from this operation
 * @return A composed {@code BiObjDoubleConsumer} that first applies this function to its input, and then consumes
 * the result using the given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*w  w  w. ja v  a2  s  . co m*/
@Nonnull
default BiObjDoubleConsumer<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(applyAsInt(t, u, value));
}

From source file:org.briljantframework.array.AbstractIntArray.java

@Override
public void forEachPrimitive(IntConsumer consumer) {
    for (int i = 0; i < size(); i++) {
        consumer.accept(get(i));
    }/*from   w ww .j av  a2 s  . co m*/
}

From source file:org.diorite.impl.world.io.anvil.serial.AnvilSerialIOService.java

private boolean await_(final IntConsumer rest, final int timer) throws InterruptedException {
    if (this.queue.isEmpty()) {
        if (rest != null) {
            rest.accept(0);
        }/*from ww  w  .j  av a  2s  .  c  om*/
        return false;
    }
    synchronized (this.queue) {
        this.queue.wait(timer);
    }
    if (rest != null) {
        rest.accept(this.queue.size());
    }
    return true;
}

From source file:org.eclipse.fx.core.text.TextUtil.java

/**
 * Apply the consumer for each matched char
 *
 * @param content/*ww  w. jav  a  2  s.c  o  m*/
 *            the content
 * @param c
 *            the character to find
 * @param consumer
 *            the consumer who gets passed the position of the matched char
 * @since 2.4.0
 */
public static void foreachCharPosition(String content, char c, IntConsumer consumer) {
    char[] cs = content.toCharArray();
    for (int i = 0; i < cs.length; i++) {
        if (cs[i] == c) {
            consumer.accept(i);
        }
    }
}