Question

I would like to use lambdaJ for selecting specific values from list,

List<someFriends> newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(),     Matchers.containsString(("michael"))));

I want it to select values LIKE given string, with this example it is working fine, but only if the word is "michael" it won't recognize "Michael", is there any way to do this with LambdaJ?

Was it helpful?

Solution 2

Please refer to this question click here.

import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;

List newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(), Matchers.contains(equalToIgnoringCase("michael"))));

equalToIgnoringCase() returns a Matcher. Therefore, we cannot use it in containsString method.

OTHER TIPS

You can try it as follows;

List<someFriends> newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(),     Matchers.containsString(("michael")).and(Matchers.containsString(("Michael")))));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top