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
I was curious if a lambda for a variable number of arguments would work. Indeed it seems to. See:
public class Example {
public interface Action {
public void accept(T... ts);
}
public static void main(String args[]) {
// Action a = (String... x) -> { also works
Action a = (x) -> {
for(String s : x) {
System.out.println(s);
}
};
a.accept("Hello", "World");
}
}
I know the question has been answered. This is mainly for others who are curious and come across this post.