add

open override fun add(e: E): Boolean

Adds the specified element to this set if it is not already present. More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false.

Return

true if this set did not already contain the specified element

Parameters

e

element to be added to this set

Throws

if the specified object cannot be compared with the elements currently in this set

if the specified element is null and this set uses natural ordering, or its comparator does not permit null elements