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:Main.java

public static void main(String[] args) {
    IntConsumer ic = (x) -> System.out.println(x);

    ic.accept(3);

}

From source file:Main.java

public static void start(IntConsumer cons, int d) {
    cons.accept(d);
}

From source file:at.gridtec.lambda4j.consumer.tri.obj.BiObjIntConsumer.java

/**
 * Creates a {@link BiObjIntConsumer} which uses the {@code third} parameter of this one as argument for the given
 * {@link IntConsumer}.// w w w .  jav  a 2s.c  om
 *
 * @param <T> The type of the first argument to the consumer
 * @param <U> The type of the second argument to the consumer
 * @param consumer The consumer which accepts the {@code third} parameter of this one
 * @return Creates a {@code BiObjIntConsumer} which uses the {@code third} parameter of this one as argument for the
 * given {@code IntConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjIntConsumer<T, U> onlyThird(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(value);
}

From source file:io.servicecomb.config.DynamicPropertiesImpl.java

@Override
public int getIntProperty(String propertyName, IntConsumer consumer, int defaultValue) {
    DynamicIntProperty prop = propertyFactoryInstance().getIntProperty(propertyName, defaultValue);
    prop.addCallback(() -> consumer.accept(prop.get()));
    return prop.get();
}

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

/**
 * Returns a composed {@link BiConsumer2} that fist applies this function to its input, and then consumes the result
 * using the given {@link IntConsumer}./*from   www.  j ava  2  s.  co  m*/
 * 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 BiConsumer2} 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}
 */
@Nonnull
default BiConsumer2<T, U> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u) -> consumer.accept(applyAsInt(t, u));
}

From source file:net.mozq.picto.core.ProcessCore.java

public static void processFiles(ProcessCondition processCondition,
        Function<Integer, ProcessData> processDataGetter, IntConsumer processDataUpdater,
        Function<ProcessData, ProcessDataStatus> overwriteConfirm, BooleanSupplier processStopper)
        throws IOException {

    int index = 0;
    while (!processStopper.getAsBoolean()) {

        ProcessData processData = processDataGetter.apply(index);
        if (processData == null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                // NOP
            }//from  w w w  .ja  v a  2s  . c o m
            continue;
        }

        processData.setStatus(ProcessDataStatus.Processing);
        processDataUpdater.accept(index);

        ProcessDataStatus status;
        try {
            if (processCondition.isDryRun()) {
                // NOP
                status = ProcessDataStatus.Success;
            } else {
                status = process(processCondition, processData, overwriteConfirm);
            }
            processData.setStatus(status);
        } catch (Exception e) {
            processData.setStatus(ProcessDataStatus.Error);
            processData.setMessage(e.getLocalizedMessage());
            App.handleWarn(e.getMessage(), e);
        }

        processDataUpdater.accept(index);
        if (processData.getStatus() == ProcessDataStatus.Error
                || processData.getStatus() == ProcessDataStatus.Terminated) {
            break;
        }

        index++;
    }
}

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

/**
 * Returns a composed {@link TriConsumer} that fist applies this function to its input, and then consumes the result
 * using the given {@link IntConsumer}./*  w  ww .ja v  a 2  s  . c  om*/
 * 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 TriConsumer} 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}
 */
@Nonnull
default TriConsumer<T, U, V> consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, v) -> consumer.accept(applyAsInt(t, u, v));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiBooleanToIntFunction.java

/**
 * Returns a composed {@link BiBooleanConsumer} 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 BiBooleanConsumer} 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  a v a  2s  .co m
@Nonnull
default BiBooleanConsumer consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsInt(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiByteToIntFunction.java

/**
 * Returns a composed {@link BiByteConsumer} 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 BiByteConsumer} 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 va2 s  . com*/
@Nonnull
default BiByteConsumer consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsInt(value1, value2));
}

From source file:at.gridtec.lambda4j.function.bi.conversion.BiCharToIntFunction.java

/**
 * Returns a composed {@link BiCharConsumer} 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 BiCharConsumer} 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  .jav a2 s  .c  om
@Nonnull
default BiCharConsumer consume(@Nonnull final IntConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsInt(value1, value2));
}