function - Combining lambdas in Java? -


i have lambda

(a, b) -> {   a.dosomething();   a.doanotherthing();   return b.dosomething(); } 

right now, gets used parameter in single method. however, create similar lambda

(a) -> {   a.dosomething();   a.doanotherthing();   return } 

is there way reuse code? like

(a, b) -> {   partial(a)   return b.dosomething(); }  (a) -> {   partial(a)   return a; } 

if understood correctly want call lambda lambda?

you give them name , use them other function

function<x,y> partial = (a) -> {     a.dosomething();     a.doanotherthing();     return a; }  bifunction<x,y,z> lam = (a, b) -> {   partial.apply(a);   return b.dosomething(); } 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -