Domanda

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?

È stato utile?

Soluzione 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.

Altri suggerimenti

You can try it as follows;

List<someFriends> newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(),     Matchers.containsString(("michael")).and(Matchers.containsString(("Michael")))));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top