Home
Sign Up
Sign In
V2EX
›
问与答
请教: Java 中如何对布尔列表取或逻辑
shanghai1943
·
Dec 24, 2021
· 1593 views
This topic created in 1800 days ago, the information mentioned may be changed or developed.
有一个 Boolean 的 list ,想对这个 list 进行或逻辑,假如有一个为 true ,那结果就为 true ,有什么工具类或者简单办法么。
谢谢。
true
List
逻辑
boolean
2 replies
•
2021-12-25 03:58:24 +08:00
ccde8259
Dec 24, 2021 via iPhone
2
1
list.stream
().anyMatch(Function.identity())
EscYezi
Dec 25, 2021 via iPhone
2
list.contains(true)
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
2116 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms ·
UTC 03:49
·
PVG 11:49
·
LAX 19:49
·
JFK 22:49
♥ Do have faith in what you're doing.
❯