![]() |
VOOZH | about |
The equals(Object O) method of CopyOnWriteArraySet compares the specified object with this set for equality. Returns true if the specified object is the same object as this object, or if it is also a Set and the elements returned by an iterator over the specified set are the same as the elements returned by an iterator over this set. More formally, the two iterators are considered to return the same elements if they return the same number of elements and for every element e1 returned by the iterator over the specified set, there is an element e2 returned by the iterator over this set such that (e1==null ? e2==null : e1.equals(e2)).
Syntax:
public boolean equals(Object O)
Parameters: This function accepts a mandatory parameter Object O which is the Object with which the CopyOnWriteArraySet is to be compared.
Return Value: The function returns true if the compared object is equal to this Set.
Program 1:
CopyOnWriteArraySet 1: [32, 67, 98, 100] CopyOnWriteArraySet 2: [32, 67, 98, 100] Both are Equal
Program 2:
CopyOnWriteArraySet 1: [32, 67, 98, 100] CopyOnWriteArraySet 2: [3, 6, 9, 10] Both are not Equal