Example usage for java.util.function Consumer accept

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

Introduction

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

Prototype

void accept(T t);

Source Link

Document

Performs this operation on the given argument.

Usage

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

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

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

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

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

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

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

/**
 * Creates a {@link BiObjIntConsumer} which uses the {@code first} parameter of this one as argument for the given
 * {@link Consumer}.//from  w  w w .ja v a2  s. co  m
 *
 * @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 first} parameter of this one
 * @return Creates a {@code BiObjIntConsumer} which uses the {@code first} parameter of this one as argument for the
 * given {@code Consumer}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjIntConsumer<T, U> onlyFirst(@Nonnull final Consumer<? super T> consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(t);
}

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

/**
 * Creates a {@link BiObjIntConsumer} which uses the {@code second} parameter of this one as argument for the given
 * {@link Consumer}./* w w w  . j av  a 2 s.  co m*/
 *
 * @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 second} parameter of this one
 * @return Creates a {@code BiObjIntConsumer} which uses the {@code second} parameter of this one as argument for
 * the given {@code Consumer}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjIntConsumer<T, U> onlySecond(@Nonnull final Consumer<? super U> consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(u);
}

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

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

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

/**
 * Creates a {@link BiObjLongConsumer} which uses the {@code second} parameter of this one as argument for the given
 * {@link Consumer}.//w  ww  . j  a  v  a2s.c o  m
 *
 * @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 second} parameter of this one
 * @return Creates a {@code BiObjLongConsumer} which uses the {@code second} parameter of this one as argument for
 * the given {@code Consumer}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjLongConsumer<T, U> onlySecond(@Nonnull final Consumer<? super U> consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(u);
}

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

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

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

/**
 * Creates a {@link BiObjShortConsumer} which uses the {@code second} parameter of this one as argument for the
 * given {@link Consumer}./*w w  w. java 2s. c  o m*/
 *
 * @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 second} parameter of this one
 * @return Creates a {@code BiObjShortConsumer} which uses the {@code second} parameter of this one as argument for
 * the given {@code Consumer}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T, U> BiObjShortConsumer<T, U> onlySecond(@Nonnull final Consumer<? super U> consumer) {
    Objects.requireNonNull(consumer);
    return (t, u, value) -> consumer.accept(u);
}

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

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