📌  相关文章
📜  在java代码示例中检查两个字符串是否相等

📅  最后修改于: 2022-03-11 14:52:26.211000             🧑  作者: Mango

代码示例2
List strings = Arrays.asList("a", "b", "a", ...);
//One Way Of Doing It
if(new HashSet<>(strings).size() == 1) {
    // all strings are equal
}
//Another Way Of Doing Iz:
if(strings.stream().distinct().count() == 1) {
    // all strings are equal
}