list.stream().filter(x -> x > 0).map(x -> x * 2).toList();
Filter, transform, collect
list.forEach(System.out::println);
Method reference
Comparator.comparing(Person::getAge)
Comparator via method reference
Cookies & your privacy
We use essential cookies to keep this site working and secure.
With your permission, we'd also like to use Google Analytics cookies to understand site traffic.
We don't use advertising or social media tracking cookies, and we honor Global Privacy Control (GPC) browser signals.
Learn more in our Privacy Policy.
Your browser is sending a GPC signal, so analytics stays off even if you accept.