Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
import java.util.List;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
public interface ValueCapture {
|
||||
public static void main(String... arguments) {
|
||||
List<IntSupplier> closures = IntStream.rangeClosed(0, 10)
|
||||
.<IntSupplier>mapToObj(i -> () -> i * i)
|
||||
.collect(toList())
|
||||
;
|
||||
|
||||
IntSupplier closure = closures.get(3);
|
||||
System.out.println(closure.getAsInt()); // prints "9"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue