Created
August 17, 2019 12:28
-
-
Save jnizet/d45d2e3754a30c7c364410669ce40e8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
public class Benchmark { | |
public static void main(String[] args) { | |
System.out.println(Arrays.asList(1, 2, 3, 4, 5) | |
.stream() | |
.filter(i -> i > 10) | |
.map(i -> { | |
try { | |
Thread.sleep(10000L); // simulating hard work | |
return i; | |
} | |
catch (InterruptedException e) { | |
return 0; | |
} | |
}) | |
.collect(Collectors.toList())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment