Вопрос

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?

Это было полезно?

Решение 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.

Другие советы

You can try it as follows;

List<someFriends> newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(),     Matchers.containsString(("michael")).and(Matchers.containsString(("Michael")))));
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top