Skip to content

Instantly share code, notes, and snippets.

@hoangbits
Created September 29, 2022 03:33
Show Gist options
  • Save hoangbits/4e0254c524dc3e81f8fd78f5c086fecf to your computer and use it in GitHub Desktop.
Save hoangbits/4e0254c524dc3e81f8fd78f5c086fecf to your computer and use it in GitHub Desktop.
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