Closed GoogleCodeExporter closed 8 years ago
The best way to implement your own predicate is to write an anonymous inner
class extending ch.lambdaj.function.matcher.LambdaJMatcher. In this way you are
only required to implement matches method. Moreover by extending that class you
can combine two or more predicates by using the or(Matcher<T> matcher) and
and(Matcher<T> matcher) provided by that class.
Original comment by mario.fu...@gmail.com
on 9 Jan 2011 at 4:43
Well, LambdaJMatcher.matches is not type safe, so this is not optimal choice
for me. I really don't want to write additional cast I implement a predicate. I
use code folding in IntelliJ to fold verbose anonymous class syntax. Making it
more verbose by adding cast every time strikes out all the benefits of cold
folding and using "poor man's" lambda expressions.
Maybe you could make LambdaJMatcher to extend TypeSafeMatcher instead of
BaseMatcher?
Thx,
koppernickus
Original comment by adamcze...@gmail.com
on 9 Jan 2011 at 5:11
Original comment by mario.fu...@gmail.com
on 9 Jan 2011 at 6:54
I didn't change the LambdaJMatcher in order to keep backward compatibility. I
added a class Predicate extending it (basically a type safe LambdaJMatcher),
having an apply() abstract method that has to be overridden in order to define
the matching condition.
It will be available starting form release 2.3.2
Original comment by mario.fu...@gmail.com
on 11 Jan 2011 at 1:23
Original issue reported on code.google.com by
kopperni...@gmail.com
on 28 Dec 2010 at 2:22