Last active
December 14, 2015 11:09
-
-
Save lessandro/5077333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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