+ 1

How to solve isEqules using Arraylist class in java !?

Instance method isEqual that accepts a parameter aSet of type Set. The method will return true, if aSet is equal to “this object”, else it will return false. Two sets are equal, if they contain the same elements in any order. Ex: Let A and B be two sets; A = {7, 4, 20, 15, 12}, B = {4, 7, 12, 15, 20}. As sets A and B contain same elements, but in different order, therefore, they are equal.

11th Apr 2018, 1:52 PM
Zainab
Zainab  - avatar
1 ответ
0
They may be equal if they contain the same values as you mentioned, but you would have to sort the unsorted set first, and them you may compare.
11th Apr 2018, 7:52 PM
Roberto Guisarre
Roberto Guisarre - avatar