我想使用lambdaJ从列表中选择特定值,
List<someFriends> newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(), Matchers.containsString(("michael"))));
我希望它选择LIKE给定字符串的值,这个例子它工作正常,但只有当单词是“michael”它才会识别“Michael”时,有没有办法用LambdaJ做到这一点? / p>
答案 0 :(得分:2)
您可以按照以下方式尝试;
List<someFriends> newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(), Matchers.containsString(("michael")).and(Matchers.containsString(("Michael")))));
答案 1 :(得分:1)
请参阅此问题click here。
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
List newFriends = select(firendsCollection,having(on(someFriends.class).getDescription(), Matchers.contains(equalToIgnoringCase("michael"))));
equalToIgnoringCase()返回一个Matcher。因此,我们不能在containsString方法中使用它。