Collections

An immutable `Set` with no elements.

- `Anything`
  - `Object`
    - `emptySet` ...and other supertypes

- `emptySet`
  - `Object`
    - `Anything`
  - `Set`
    - `Collection`
      - `Iterable`
        - `Category`

no subtypes hierarchy

Attributes
`empty` | Source Code `shared actual Boolean empty` Determines if the stream is empty, that is to say, if the iterator returns no elements. Refines `Collection.empty` ultimately refines `Iterable.empty`
`size` | Source Code `shared actual Integer size` The number of elements returned by the `Iterable.iterator()` of this stream, if the iterator terminates. In the case of an infinite stream, this operation never terminates. Refines `Iterable.size`

Inherited Attributes
Attributes inherited from: `Object` `hash`, `string`
Attributes inherited from: `Collection<Element>` `empty`, `permutations`, `string`
Attributes inherited from: `Iterable<Element,Absent>` `coalesced`, `cycled`, `distinct`, `empty`, `exceptLast`, `first`, `indexed`, `last`, `paired`, `rest`, `size`, `string`
Attributes inherited from: `Set<Element>` `distinct`, `hash`

Methods
`any` | Source Code `shared actual Boolean any(Boolean selecting(Nothing element))` Determines if there is at least one element of this stream that satisfies the given predicate function. If the stream is empty, returns `false`. For an infinite stream, this operation might not terminate. Refines `Iterable.any`
`by` | Source Code `shared actual {Nothing*} by(Integer step)` Produces a stream containing every `step`th element of this stream. If the step size is `1`, the resulting stream contains the same elements as this stream. For example, the expression
    (0..10).by(3)
results in the stream `{ 0, 3, 6, 9 }`. The step size must be greater than zero. Refines `Iterable.by`
`clone` | Source Code `shared actual Set<Nothing> 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 `Set.clone` ultimately refines `Collection.clone`
`complement` | Source Code `shared actual Set<Nothing> complement<Other>(Set<Other> set) given Other satisfies Object` Returns a new `Set` containing all the elements in this set that are not contained in the given `Set`. For example:
    set { "hello", "world" } ~ set { 1, 2, "hello" }
Produces the set `{ "world" }` of type `Set<String>`. Refines `Set.complement`
`contains` | Source Code `shared actual Boolean contains(Object element)` Returns `true` if the given value belongs to this `Category`, that is, if it is an element of this `Category`, or `false` otherwise. For most `Category`s the following relationship is satisfied by every pair of elements `x` and `y`: if `x==y`, then `x in category == y in category` However, it is possible to form a useful `Category` consistent with some other equivalence relation, for example `===`. Therefore implementations of `contains()` which do not satisfy this relationship are tolerated. Refines `Set.contains` ultimately refines `Category.contains`
`containsAny` | Source Code `shared actual Boolean containsAny({Object*} elements)` Returns `true` if any one of the given values belongs to this `Category`, or `false` otherwise. Refines `Category.containsAny`
`containsEvery` | Source Code `shared actual Boolean containsEvery({Object*} elements)` Returns `true` if every one of the given values belongs to this `Category`, or `false` otherwise. Refines `Category.containsEvery`
`count` | Source Code `shared actual Integer count(Boolean selecting(Nothing element))` Produces the number of elements in this stream that satisfy the given predicate function. For an infinite stream, this method never terminates. Refines `Iterable.count`
`each` | Source Code `shared actual void each(void step(Nothing element))` Call the given function for each element of this stream, passing the elements in the order they occur in this stream. For example:
    words.each((word) {
        print(word.lowercased);
        print(word.uppercased);
    });
Has the same effect as the following `for` loop:
    for (word in words) {
        print(word.lowercased);
        print(word.uppercased);
    }
For certain streams this method is highly efficient, surpassing the performance of `for` loops on the JVM. Thus, `each()` is sometimes preferred in highly performance-critical low-level code. Refines `Iterable.each`
`every` | Source Code `shared actual Boolean every(Boolean selecting(Nothing element))` Determines if all elements of this stream satisfy the given predicate function. If the stream is empty, return `true`. For an infinite stream, this operation might not terminate. Refines `Iterable.every`
`exclusiveUnion` | Source Code `shared actual Set<Other> exclusiveUnion<Other>(Set<Other> set) given Other satisfies Object` Returns a new `Set` containing only the elements contained in either this set or the given `Set`, but no element contained in both sets. Refines `Set.exclusiveUnion`
`find` | Source Code `shared actual Null find(Boolean selecting(Nothing element))` The first element of this stream which satisfies the given predicate function, if any, or `null` if there is no such element. For an infinite stream, this method might not terminate. For example, the expression
    (-10..10).find(Integer.positive)
evaluates to `1`. Refines `Iterable.find`
`findLast` | Source Code `shared actual Null findLast(Boolean selecting(Nothing element))` The last element of this stream which satisfies the given predicate function, if any, or `null` if there is no such element. For an infinite stream, this method will not terminate. For example, the expression
    (-10..10).findLast(3.divides)
evaluates to `9`. Refines `Iterable.findLast`
`intersection` | Source Code `shared actual Set<Nothing> intersection<Other>(Set<Other> set) given Other satisfies Object` Returns a new `Set` containing only the elements that are present in both this set and the given `Set` and that are instances of the intersection `Element&Other` of the element types of the two sets. For example:
    set { "hello", "world" } & set { 1, 2, "hello" }
Produces the set `{ "hello" }` of type `Set<String>`. Note that, according to this definition, and even though `1==1.0` evaluates to true, the expression
    set { 1 } & set { 1.0 }
produces the empty set `{}`. Refines `Set.intersection`
`iterator` | Source Code `shared actual Iterator<Nothing> iterator()` An iterator for the elements belonging to this stream. Refines `Iterable.iterator`
`skip` | Source Code `shared actual {Nothing*} skip(Integer skipping)` Produces a stream containing the elements of this stream, after skipping the first `skipping` elements produced by its iterator. If this stream does not contain more elements than the specified number of elements to skip, the resulting stream has no elements. If the specified number of elements to skip is zero or fewer, the resulting stream contains the same elements as this stream. Refines `Iterable.skip`
`subset` | Source Code `shared actual Boolean subset(Set<Object> set)` Determines if this set is a subset of the given `Set`, that is, if the given set contains all of the elements in this set. Refines `Set.subset`
`superset` | Source Code `shared actual Boolean superset(Set<Object> set)` Determines if this set is a superset of the given `Set`, that is, if this set contains all of the elements in the given set. Refines `Set.superset`
`take` | Source Code `shared actual {Nothing*} take(Integer taking)` Produces a stream containing the first `taking` elements of this stream. If the specified number of elements to take is larger than the number of elements of this stream, the resulting stream contains the same elements as this stream. If the specified number of elements to take is fewer than one, the resulting stream has no elements. Refines `Iterable.take`
`union` | Source Code `shared actual Set<Other> union<Other>(Set<Other> set) given Other satisfies Object` Returns a new `Set` containing all the elements of this set and all the elements of the given `Set`. For example:
    set { "hello", "world" } | set { 1, 2, "hello" }
Produces the set `{ "hello", "world", 1, 2 }` of type `Set<String|Integer>`. Note that it is possible for two sets of disjoint element type to be considered to have elements in common. For example, since `1==1.0` evaluates to true, the expression
    set { 1 } | set { 1.0 }
produces the set `{ 1 }`. Refines `Set.union`

Inherited Methods
Methods inherited from: `Object` `equals()`
Methods inherited from: `Category<Element>` `contains()`, `containsAny()`, `containsEvery()`
Methods inherited from: `Collection<Element>` `clone()`, `contains()`
Methods inherited from: `Iterable<Element,Absent>` `any()`, `by()`, `chain()`, `collect()`, `contains()`, `count()`, `defaultNullElements()`, `each()`, `every()`, `filter()`, `find()`, `findLast()`, `flatMap()`, `fold()`, `follow()`, `frequencies()`, `getFromFirst()`, `group()`, `indexes()`, `interpose()`, `iterator()`, `locate()`, `locateLast()`, `locations()`, `longerThan()`, `map()`, `max()`, `narrow()`, `partition()`, `product()`, `reduce()`, `repeat()`, `scan()`, `select()`, `sequence()`, `shorterThan()`, `skip()`, `skipWhile()`, `sort()`, `spread()`, `summarize()`, `tabulate()`, `take()`, `takeWhile()`
Methods inherited from: `Set<Element>` `clone()`, `complement()`, `contains()`, `defaultNullElements()`, `equals()`, `exclusiveUnion()`, `intersection()`, `subset()`, `superset()`, `union()`