java - Filtering using Google Guava API -


is there way check if objects in list have same attribute google guava api?

moreover, there way send more parameters predicate?

let's said want filter objects string getting user, , want predicate use parameter when applying filter.

you can create own predicate follows:

class mypredicate implements predicate<myobject> {   private final string parameter;    public mypredicate(string parameter) {this.parameter = parameter;}    boolean apply(myobject input) {   // apply predicate using parameter.   } } 

you can filter doing:

iterables.filter(myiterable, new mypredicate(myparameter)); 

you should wary though performs lazy filter.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -