public class Goolean{ private final Boolean value; public Goolean(boolean theValue) { value = theValue; } public Goolean whenTrue(Consumer alternative){ if( value ){ alternative.accept(null); } return this; } public Goolean whenFalse(Consumer alternative){ if( !value ){ alternative.accept(null); } return this; } public Goolean or(Goolean other){ return or(other.value); } public Goolean or(boolean other){ return new Goolean(value || other); } public Boolean getValue(){ return value; } public Goolean and(boolean other){ return new Goolean(value && other); } public Goolean and(Goolean other){ return and(other.value); } public Goolean or(Function alternative){ return or(new Goolean(alternative.apply(value))); } public Goolean and(Function alternative){ return and(new Goolean(alternative.apply(value))); } }