سؤال

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