public class Exercise6 {
public static void main(String[] args) {
List<Person> list1 = new ArrayList<Person>();
list1.add(new Person("张三", 19));
list1.add(new Person("李四", 22));
list1.add(new Person("王五", 19));
List<Person> list2 = new ArrayList<Person>();
list2.add(new Person("张三", 19));
list2.add(new Person("李四", 22));
list2.add(new Person("王五", 19));
List<Person> list3 = new ArrayList<Person>();
list3.add(new Person("张三", 19));
list3.add(new Person("李四", 22));
list3.add(new Person("赵六", 21));
System.out.println(deepEquals(list1, list3));
System.out.println(deepEquals(list1, list2));
}
public static boolean deepEquals(List list1,List list2){
return list1.containsAll(list2) && list2.containsAll(list1); //返回的结果都是false 求助 list1 和list2 完全相等 第二个应该是true的 帮忙找找那里有问题
}
} |