Skip to content

Instantly share code, notes, and snippets.

@praveer09
praveer09 / ExtensionUsingJava8Funtion.java
Created November 4, 2017 06:30
Example showing how existing interfaces can be extended to provide additional features by using the Function interface, introduced in Java 8, without breaking existing code.
import java.util.function.Function;
public class ExtensionUsingJava8Funtion {
public static void main(String[] args) {
SomeInterface someInterface = new SomeInterfaceImpl();
demoAdaptingInput(someInterface);
demoAdaptingOutput(someInterface);
demoAdaptingBothInputAndOutput(someInterface);
}