Stream#anyMatch返回空流的false,而Stream#allMatch和Stream#noneMatch返回空流的true。
为什么anyMatch的行为与allMatch和noneMatch对于空流的行为不同?
发布于 2022-09-10 09:11:31
Stream#anyMatch计算流元素上谓词的存在量量化。对于一个false,存在量化总是计算为空集。
另一方面,Stream#allMatch计算流元素上谓词的通用量化,Stream#noneMatch计算流元素上否定谓词的通用量化。对于一个true,通用量化总是计算为空集。
https://stackoverflow.com/questions/73670610
复制相似问题