Example usage for java.util.function LongConsumer accept

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

Introduction

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

Prototype

void accept(long value);

Source Link

Document

Performs this operation on the given argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    LongConsumer i = (l) -> System.out.println(l);
    ;/*from   ww w .  j  av a 2 s.c om*/
    i.accept(Long.MAX_VALUE);
}

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

/**
 * Creates a {@link BiObjLongConsumer} which uses the {@code third} parameter of this one as argument for the given
 * {@link LongConsumer}./*from www  . j av 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 BiObjLongConsumer} which uses the {@code third} parameter of this one as argument for
 * the given {@code LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjLongConsumer<T, U> onlyThird(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(value);
}

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

@Override
public long getLongProperty(String propertyName, LongConsumer consumer, long defaultValue) {
    DynamicLongProperty prop = propertyFactoryInstance().getLongProperty(propertyName, defaultValue);
    prop.addCallback(() -> consumer.accept(prop.get()));
    return prop.get();
}

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

/**
 * Returns a composed {@link BiConsumer2} that fist applies this function to its input, and then consumes the result
 * using the given {@link LongConsumer}.
 * 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 LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *///from www.  ja v  a2  s . c o m
@Nonnull
default BiConsumer2<T, U> consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u) -> consumer.accept(applyAsLong(t, u));
}

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

/**
 * Returns a composed {@link TriConsumer} that fist applies this function to its input, and then consumes the result
 * using the given {@link LongConsumer}.
 * 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 LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *///from   w  w w .ja  va  2  s.  co  m
@Nonnull
default TriConsumer<T, U, V> consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, v) -> consumer.accept(applyAsLong(t, u, v));
}

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

/**
 * Returns a composed {@link BiBooleanConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link LongConsumer}. 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 LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *///from   w w w  . j  a  v  a 2s.  co  m
@Nonnull
default BiBooleanConsumer consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsLong(value1, value2));
}

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

/**
 * Returns a composed {@link BiByteConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link LongConsumer}. 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 LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from  w  w  w. j  a  v a  2  s. c  om*/
@Nonnull
default BiByteConsumer consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsLong(value1, value2));
}

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

/**
 * Returns a composed {@link BiCharConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link LongConsumer}. 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 LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *//*from   ww w . ja  va 2s .c  o m*/
@Nonnull
default BiCharConsumer consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsLong(value1, value2));
}

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

/**
 * Returns a composed {@link BiFloatConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link LongConsumer}. 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 BiFloatConsumer} that first applies this function to its input, and then consumes the
 * result using the given {@code LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *///from www  .ja  v a2 s . c o  m
@Nonnull
default BiFloatConsumer consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsLong(value1, value2));
}

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

/**
 * Returns a composed {@link BiShortConsumer} that fist applies this function to its input, and then consumes the
 * result using the given {@link LongConsumer}. 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 BiShortConsumer} that first applies this function to its input, and then consumes the
 * result using the given {@code LongConsumer}.
 * @throws NullPointerException If given argument is {@code null}
 *///w  w w  . j  a v a 2  s . c o  m
@Nonnull
default BiShortConsumer consume(@Nonnull final LongConsumer consumer) {
    Objects.requireNonNull(consumer);
    return (value1, value2) -> consumer.accept(applyAsLong(value1, value2));
}