P
P
parkito2017-04-25 00:01:15
Java
parkito, 2017-04-25 00:01:15

How to write a ternary function through a lambda without using a custom functional interface?

Hello. It is necessary to write the function f=x+y+z in the body of the method through lambdas.
Something like this

public int fnk(x,y,z){
x=(x,y,z)->{x+y+z};
return x;
}

Without defining my functional interface, I have no idea how this can be done.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
parkito, 2017-04-25
@parkito

That's what I meant

Function<Integer, Function<Integer, Function<Integer, Integer>>> calculation
= x -> y -> z -> x + y + z;

G
gleendo, 2017-04-25
@evgeniy8705

// так ли не проще сделать?!
public int func(a, b, c) {
  return a + b + c;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question