Can a java lambda have more than 1 parameter?

后端 未结 6 2064
渐次进展
渐次进展 2020-11-28 18:24

In Java, is it possible to have a lambda accept multiple different types?

I.e: Single variable works:

    Function  adder = i         


        
6条回答
  •  温柔的废话
    2020-11-28 19:11

    You could also use jOOL library - https://github.com/jOOQ/jOOL

    It has already prepared function interfaces with different number of parameters. For instance, you could use org.jooq.lambda.function.Function3, etc from Function0 up to Function16.

提交回复
热议问题