Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Determines whether a set is identical to the current set.
Syntax
public boolean equal(Set set)
Run On
Called
Parameters
- set
Type: Set Class
The set to be compared with the current set.
Return Value
Type: boolean
true if the set is the same as the current set; otherwise, false.
Remarks
For two sets to be equal, they must have the same type and the same number of elements, and all elements must be the same.
Examples
The following example creates two sets of integers, adds some values to them, and then compares them to see whether the sets are the same.
{
Set is1 = new Set (Types::Integer);
Set is2 = new Set (Types::Integer);
;
is1.add(1);
is1.add(2);
is1.add(3);
is2.add(2);
is2.add(4);
if (is1.equal(is2))
{
print "The sets are equal";
pause;
}
else
{
print "The sets are not equal";
pause;
}
}