Java Reference
In-Depth Information
Figure 3.6. Using andThen vs. compose
This all sounds a bit too abstract. How can you use these in practice? Let's say you have various
utility methods that do text transformation on a letter represented as a String:
public class Letter{
public static String addHeader(String text){
return "From Raoul, Mario and Alan: " + text;
}
public static String addFooter(String text){
return text + " Kind regards";
}
public static String checkSpelling(String text){
return text.replaceAll("labda", "lambda");
}
}
 
Search WWH ::




Custom Search