使用lambda:
people.forEach((p) -> p.setBorn(true));
没有发现仅使用Java 8 API的其他方法。
使用此自定义功能:
public static <T, U> Consumer<T> bind2(BiConsumer<? super T, U> c, U arg2) { return (arg1) -> c.accept(arg1, arg2);}你可以做:
people.forEach(bind2(Person::setBorn, true));
如果Java API或库中提供了这种实用程序方法,请告诉我们。



