一种方法是获取第一个列表的名称,然后调用
allMatch并进行检查。
String firstName = yourListOfAs.get(0).name;boolean allSameName = yourListOfAs.stream().allMatch(x -> x.name.equals(firstName));

一种方法是获取第一个列表的名称,然后调用
allMatch并进行检查。
String firstName = yourListOfAs.get(0).name;boolean allSameName = yourListOfAs.stream().allMatch(x -> x.name.equals(firstName));