Created
September 29, 2022 03:33
-
-
Save hoangbits/4e0254c524dc3e81f8fd78f5c086fecf 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.List; | |
import java.util.stream.Collectors; | |
class Main { | |
public static void main(String[] args) { | |
List<Integer> list = Arrays.asList(3, 4, 6, 12, 20); | |
List<Integer> ket_qua = list.stream() | |
.filter(num -> { | |
System.out.println(String.format("Gia tri cua num: %s", num)); | |
return num > 4; | |
}).collect(Collectors.toList()); | |
System.out.println(String.format("@@Gia tri cua num: %s", ket_qua)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment