Reputation: 193
I have an ArrayList of Sets , I would like to find the unique sets among this ArrayList of Sets .
Please help me regarding this.
Upvotes: 0
Views: 955
Reputation: 500367
Let's call your ArrayList<Set<T>>
al
. You can put its elements into a Set
:
Set<Set<T>> unique = new HashSet<Set<T>>(al);
The elements of unique
will give you the unique sets.
P.S. In the above, T
is some type (you haven't told us what it is, so I've used a generic name).
Upvotes: 5