public class Customer {
private String name;
private int points;
public boolean hasOverHundredPoints() {
return this.points > 100;
}
}
public class Customers {
public List<Customer> getCustomers(){
return this.customers
.stream()
.filter(Customer::hasOverHundredPoints)
.collect(Collectors.toList());
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter