kbwelker
unread,Mar 1, 2012, 12:53:10 PM3/1/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Funcito
It seems like another "common" pattern of Function usage for filtering
would be to compare the equality of a method return value (i.e., a
POJO "getter") against a fixed value. So it might be nice to support
the production of a Predicate-like object (details depending on each
library), provided a method to be called, and a value to compare
against.
In Guava, this might entail using:
Predicates.compose( Predicates.equalTo(value), Function )
FJ does not have predicate class, but does have method requiring an
F<T,Boolean>, such as List.filter()
Jedi might involve either Filter2, or more likely EqualObjectFilter.
I'm thinking the approximate usage for any of these might look like:
Predicate p = equalsFor( callsTo(X.class).getVal, valToCompare );