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
Post a Comment