Skip to content

Instantly share code, notes, and snippets.

@lessandro
Last active December 14, 2015 11:09
Show Gist options
  • Save lessandro/5077333 to your computer and use it in GitHub Desktop.
Save lessandro/5077333 to your computer and use it in GitHub Desktop.
public static List<Person> filter_name(List<Person> list, final String name) {
return guava_filter(list, new Predicate() {
bool apply(Person p) {
return p.name == name;
}
});
}
// ----------------
class FilterName implements Predicate<Person>
{
private String name;
public FilterName(String name) {
this.name = name;
}
bool apply(Person person) {
return person.name == this.name;
}
}
filter(list, name) {
return guava_filter(list, new FilterName(name));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment