I have two ArrayList as :
ArrayOne
ClassPojo [Name ="XXX", FilterID = 4]
ClassPojo [Name = "ZZZ", FilterID = 5]
ArrayTwo
ClassPojo [Name = "XXX", FilterID = 4]
but when try to use:
Arrays.asList(ArrayOne).contains(ArrayTwo )
or
ArrayOne().containsAll(ArrayTwo)
it returns false, i know the comparing is based on Refrences not Values equlaty but how i can do it by values note that: i want to use conatinsAll , so if the content of arrayTwo is found in some part of ArrayOne return true .
i know the comparing is based on references not Values equality
No, it is based on value equality. You need to override equals() to properly compare 2 objects of your ClassPojo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With