Created
May 17, 2018 13:51
-
-
Save mgandin/9df8fff38fb8fb18e89cf4d5d16eb66e to your computer and use it in GitHub Desktop.
Don't do that at home kid, it burns !
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 static java.util.Arrays.asList; | |
import java.util.List; | |
import java.util.stream.Stream; | |
public class Main { | |
public static void main(String[] args) { | |
List<Integer> numbers = asList(1, 2, 3, 4, 5); | |
int[] factor = {2}; | |
Stream<Integer> integerStream = numbers.stream() | |
.filter(i -> i % 2 == 0) | |
.map(i -> i * factor[0]); | |
factor[0] = 3; | |
integerStream | |
.forEach(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment