package CUTexamples; import java.util.function.Function; import java.util.logging.Logger; public class ExtendedLogger { Logger logger ; Function cmd ; static Function SKIP = x -> null ; public ExtendedLogger(Logger l) { logger = l ; } public ExtendedLogger with(String m) { cmd = x -> { logger.info(m) ; return null ; } ; return this ; } public ExtendedLogger If(boolean b) { if (!b) cmd = SKIP ; return this ; } public void send() { cmd.apply(null) ; } }