select(list, having(on(Integer.class).intValue() % 2, equalTo(0)));
the code above throws exception.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
%operation has to be evaluated before select() whereas what you want it to be evaluated for each entry. i.e. what you want is closures which is available in Java 8.If you were using a loop you could write
Java’s syntax often makes using a loop the cleanest solution when ideally you should have a choice (its also a lot faster).