A MutableSet
implemented as a hash set stored in an
Array
of singly linked lists. Each element is assigned
an index of the array according to its hash code. The hash
code of an element is defined by Object.hash
.
The stability
of a HashSet
controls its iteration
order:
linked
set has a stable and meaningful order of
iteration. The elements of the set form a linked list,
where new elements are added to the end of the linked
list. Iteration of the set follows this linked list, from
least recently added elements to most recently added
elements.unlinked
set has an unstable iteration order that
may change when the set is modified. The order itself is
not meaningful to a client.The management of the backing array is controlled by the
given hashtable
.
no subtypes hierarchy
Initializer |
HashSet(Stability stability = ..., Hashtable hashtable = ..., {Element*} elements = ...) Parameters:
|
Attributes | |
first | Source Codeshared actual Element? first The first element returned by the iterator, if any, or
Refines Iterable.first |
hash | Source Codeshared actual 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 |
last | Source Codeshared actual Element? last The last element returned by the iterator, if any, or
Refines Iterable.last |
size | Source Codeshared actual Integer size The number of elements returned by the Refines Iterable.size |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Iterable<Element,Absent> |
Attributes inherited from: Set<Element> |
Methods | |
add | Source Codeshared actual Boolean add(Element element) Add the given Refines SetMutator.add |
addAll | Source Codeshared actual Boolean addAll({Element*} elements) Add the given Refines SetMutator.addAll |
clear | Source Codeshared actual void clear() Remove every element from this set, leaving an empty set with no elements. Refines SetMutator.clear |
clone | Source Codeshared actual HashSet<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. |
complement | Source Codeshared actual HashSet<Element> complement<Other>(Set<Other> set) Returns a new Refines Set.complement |
contains | Source Codeshared actual Boolean contains(Object element) Returns For most
However, it is possible to form a useful |
count | Source Codeshared actual Integer count(Boolean selecting(Element element)) Produces the number of elements in this stream that
satisfy the given predicate function ( Refines Iterable.count |
equals | Source Codeshared actual Boolean equals(Object that) Determine if two values are equal. Implementations should respect the constraints that:
Furthermore it is recommended that implementations
ensure that if A class which explicitly refines |
exclusiveUnion | Source Codeshared actual HashSet<Element|Other> exclusiveUnion<Other>(Set<Other> set) Returns a new Refines Set.exclusiveUnion |
intersection | Source Codeshared actual HashSet<Element&Other> intersection<Other>(Set<Other> set) Returns a new Refines Set.intersection |
iterator | Source Codeshared actual Iterator<Element> iterator() An iterator for the elements belonging to this stream. Refines Iterable.iterator |
remove | Source Codeshared actual Boolean remove(Element element) Remove an Refines SetMutator.remove |
union | Source Codeshared actual HashSet<Element|Other> union<Other>(Set<Other> set) Returns a new Refines Set.union |
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() |
Methods inherited from: Set<Element> |
Methods inherited from: SetMutator<Element> |