001package Torello.Java.Function; 002 003/** 004 * Function-Pointer 005 * <SPAN CLASS=TJF>Input:</SPAN> {@code byte} 006 * <SPAN CLASS=TJF>Output:</SPAN> {@code void}. 007 * 008 * <BR /><BR /> 009 * This is an extension of {@code java.util.function.*}. This consumer accepts a {@code 'byte'} 010 * as input to its {@code 'accept'} method. 011 */ 012@FunctionalInterface 013public interface ByteConsumer 014{ 015 /** 016 * Performs this operation on the given argument. 017 * <BR /><BR /><EMBED CLASS='external-html' DATA-FILE-ID=FUNC_INTER_METH> 018 * 019 * @param b {@code byte} input-argument. 020 */ 021 public void accept(byte b); 022 023 /** 024 * <EMBED CLASS='external-html' DATA-FILE-ID=CON_AND_THEN_METHOD> 025 * @param after <EMBED CLASS='external-html' DATA-FILE-ID=CON_AND_THEN_AFTER> 026 * @return <EMBED CLASS='external-html' DATA-FILE-ID=CON_AND_THEN_RETURN> 027 * @throws NullPointerException if parameter {@code 'other'} is null. 028 */ 029 default ByteConsumer andThen(ByteConsumer after) 030 { 031 if (after == null) 032 throw new NullPointerException("null has been passed to parameter 'after'"); 033 034 return (byte b) -> 035 { 036 this.accept(b); 037 after.accept(b); 038 }; 039 } 040}