I am learning LambdaJ and everytime I need to achieve a task I have to check at existing examples and modify them in order to use lambdaj.
I have started using it but I think I'm missing something here that would like to ask you.
I'm not clear about using having
method. I don't understand how it works and how I can I use it.
I have debugged, decompiled and read its documentation but I don't find the "way of thinking" lambda.
having
javadoc says:
static HasArgumentWithValue having(A argument, org.hamcrest.Matcher matcher)
Creates an hamcrest matcher that is evalued to true if the value of the given argument satisfies the condition defined by the passed matcher.
I've used having
in examples like this:
List<User> result = filter(having(on(User.class).getAge(), greaterThan(20)), list);
I understand that having
applies a harmcrest matcher to an argument and repeats that all over the list.
But my question is how does having works? How do I think in a functional way on lambdaj?