I have a class B which extends class A
abstract class A{
Integer val;
}
class B extends A {...}
Now there is a list1 of class A objects, which I need to compare and check if they are equal in values and order as well, with another list2 I get after I apply a certain sort on the list1
B var1 = new B();
B.setVal(1);
B var2 = new B();
B.setVal(null);
B var3 = new B();
B.setVal(10);
B var4 = new B();
B.setVal(15);
List<B> list1 = Lists.newArrayList();
Now I have a sort method which gives list2
list2 = [null,1,5,10]
What method can I use to verify list1<>list2 ?
When I tried equals(), it is giving me list1 == list2