Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Last active December 19, 2016 14:30
Show Gist options
  • Select an option

  • Save sliskiCode/468afc131645d3e545d7941a892ee923 to your computer and use it in GitHub Desktop.

Select an option

Save sliskiCode/468afc131645d3e545d7941a892ee923 to your computer and use it in GitHub Desktop.
Living (Android) without Kotlin #7
void foo(List<Person> persons) {
persons.stream()
.filter(it -> it.getAge() >= 21)
.filter(it -> it.getName().startsWith("P"))
.map(Person::getName)
.sorted()
.forEach(System.out::println);
}
class Person {
final private String name;
final private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
String getName() { return name; }
int getAge() { return age; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment