Composing Consumers – Functional-Style Programming

Composing Consumers The method andThen() can be used to chain together consumers to compose compound consumers. The three consumers used earlier to resize, reverse, and print a StringBuilder can be chained together as seen here: Click here to view code image resizeSB.andThen(reverseSB)    .andThen(printSB).accept(new StringBuilder(“Banana”)); // StringBuilder: anaB The constituent consumers are executed one after the … Read moreComposing Consumers – Functional-Style Programming