Java 8: Lambda with variable arguments

前端 未结 6 1810
天命终不由人
天命终不由人 2021-01-04 02:27

I am looking for a way to invoke multiple argument methods but using a lambda construct. In the documentation it is said that lambda is only usable

6条回答
  •  甜味超标
    2021-01-04 02:37

    In Java you need to use an array like this.

    test((Object[] args) -> me.call(args));
    

    If call takes an array variable args this will work. If not you can use reflection to make the call instead.

提交回复
热议问题