import static java.lang.System.out; public class Lambda{ public static void main(String[] args) { Servicio s=(a,b) -> a-b; out.println("35 - 26 = " + new Lambda().operacion(35, 26, s)); } private int operacion(int a,int b, Servicio servicio){ return servicio.opera(a,b); } } interface Servicio{ int opera(int a,int b); }
Uso de lambdas en Java 8

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.