blob: 403ec7af7ff992d71462129a80dac8702f9b18fc [file] [log] [blame]
Pierre De Ropfaca2892016-01-31 23:27:05 +00001package org.apache.felix.dm.lambda.callbacks;
2
3import java.util.Objects;
4
5/**
6 * Represents a callback(T param) on an Object instance.
7 *
8 * @param T the type of the callback parameter.
9 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
10 */
11@FunctionalInterface
12public interface CbConsumer<T> extends SerializableLambda {
13 /**
14 * Handles the given argument
15 * @param t the argument
16 */
17 void accept(T t);
18
19 default CbConsumer<T> andThen(CbConsumer<? super T> after) {
20 Objects.requireNonNull(after);
21 return (T t) -> {
22 accept(t);
23 after.accept(t);
24 };
25 }
26}