A collection of unique elements.
A Set
is a Collection
of its elements.
Sets may be the subject of the binary union, intersection,
and complement operators |
, &
, and ~
.
value kids = girls|boys;
Elements are compared for equality using Object.equals()
or Comparable.compare()
. An element may occur at most
once in a set.
no type hierarchy
Attributes | |
hash | Source Codeshared actual default Integer hash The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that:
Therefore, a class which refines Refines Object.hash |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Iterable<Element,Absent> |
Methods | |
clone | Source Codeshared formal Set<Element> clone() A shallow copy of this collection, that is, a collection with identical elements which does not change if this collection changes. If this collection is immutable, it is acceptable to return a reference to this collection. If this collection is mutable, a newly instantiated collection must be returned. Refines Collection.clone |
complement | Source Codeshared formal Set<Element> complement<Other>(Set<Other> set) Returns a new |
contains | Source Codeshared actual default Boolean contains(Object element) The fundamental operation for |
equals | Source Codeshared actual default Boolean equals(Object that) Two Refines Object.equals |
exclusiveUnion | Source Codeshared formal Set<Element|Other> exclusiveUnion<Other>(Set<Other> set) Returns a new |
intersection | Source Codeshared formal Set<Element&Other> intersection<Other>(Set<Other> set) Returns a new |
subset | Source Codeshared default Boolean subset(Set<Object> set) Determines if this set is a subset of the given |
superset | Source Codeshared default Boolean superset(Set<Object> set) Determines if this set is a superset of the given
|
union | Source Codeshared formal Set<Element|Other> union<Other>(Set<Other> set) Returns a new |
Inherited Methods |
Methods inherited from: Category<Element> |
Methods inherited from: Collection<Element> |
Methods inherited from: Iterable<Element,Absent> Iterable.any() , Iterable.by() , Iterable.chain() , Iterable.collect() , Iterable.count() , Iterable.defaultNullElements() , Iterable.every() , Iterable.filter() , Iterable.find() , Iterable.findLast() , Iterable.flatMap() , Iterable.fold() , Iterable.follow() , Iterable.getFromFirst() , Iterable.interpose() , Iterable.iterator() , Iterable.longerThan() , Iterable.map() , Iterable.max() , Iterable.partition() , Iterable.product() , Iterable.reduce() , Iterable.repeat() , Iterable.scan() , Iterable.select() , Iterable.sequence() , Iterable.shorterThan() , Iterable.skip() , Iterable.skipWhile() , Iterable.sort() , Iterable.spread() , Iterable.take() , Iterable.takeWhile() |