Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望在 LambdaJ 选择中使用两个条件进行选择,我尝试使用and()函数,但我不知道如何使用它。上面的代码使用一个条件进行选择。我怎么能添加另一个条件?
and()
select(filteredPB, having(on(Table.class).getId(), IsEqual.equalTo(key)))
您可以将 Matchers.allOf 用于 AND,将 Matchers.anyOf 用于 OR。像这样:
select(filteredPB, Matchers.allOf( having(on(Table.class).getId(), IsEqual.equalTo(key)), having(on(Table.class).getValue(), IsEqual.equalTo(value)) ))