/** * Returns a composed {@link ObjBiIntConsumer} that performs, in sequence, this consumer followed * by the {@code after} consumer. If evaluation of either operation throws an exception, it is * relayed to the caller of the composed operation. If performing this consumer throws an * exception, the {@code after} consumer will not be performed. * * @param after The consumer to apply after this consumer is applied * @return A composed {@link ObjBiIntConsumer} that performs, in sequence, this consumer followed * by the {@code after} consumer. * @throws NullPointerException If given argument is {@code null} */ @Nonnull default ObjBiIntConsumer<T> andThen(@Nonnull final ObjBiIntConsumer<? super T> after) { Objects.requireNonNull(after); return (t, value1, value2) -> { accept(t, value1, value2); after.accept(t, value1, value2); }; }
/** * Calls the given {@link ObjBiIntConsumer} with the given arguments and returns its result. * * @param <T> The type of the first argument to the consumer * @param consumer The consumer to be called * @param t The first argument to the consumer * @param value1 The second argument to the consumer * @param value2 The third argument to the consumer * @throws NullPointerException If given argument is {@code null} */ static <T> void call( @Nonnull final ObjBiIntConsumer<? super T> consumer, T t, int value1, int value2) { Objects.requireNonNull(consumer); consumer.accept(t, value1, value2); }