Attributes
emptySource Codeshared 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
itemsSource Codeshared actual Collection<Nothing> items

A Collection containing the items stored in this map. An element can be stored under more than one key in the map, and so it can occur more than once in the resulting collection.

Refines Map.items
keysSource Codeshared actual Collection<Nothing> keys

The Category of all keys for which a value is defined by this Correspondence.

Refines Map.keys ultimately refines Correspondence.keys
sizeSource Codeshared 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.

Inherited Attributes
Attributes inherited from: Object
Attributes inherited from: Collection<Element>
Attributes inherited from: Correspondence<Key,Item>
Attributes inherited from: Iterable<Element,Absent>
Attributes inherited from: Map<Key,Item>
Methods
anySource Codeshared actual Boolean any(Boolean selecting(Nothing->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
bySource Codeshared actual {<Nothing->Nothing>*} by(Integer step)

Produces a stream containing every stepth 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
cloneSource Codeshared actual Map<Nothing,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 Map.clone ultimately refines Collection.clone
containsSource Codeshared 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 Categorys 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 Map.contains ultimately refines Category.contains
containsAnySource Codeshared actual Boolean containsAny({Object*} elements)

Returns true if any one of the given values belongs to this Category, or false otherwise.

containsEverySource Codeshared actual Boolean containsEvery({Object*} elements)

Returns true if every one of the given values belongs to this Category, or false otherwise.

countSource Codeshared actual Integer count(Boolean selecting(Nothing->Nothing element))

Produces the number of elements in this stream that satisfy the given predicate function. For an infinite stream, this method never terminates.

definesSource Codeshared actual Boolean defines(Object index)

Determines if there is a value defined for the given key.

Refines Map.defines ultimately refines Correspondence.defines
eachSource Codeshared actual void each(void step(Nothing->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.

everySource Codeshared actual Boolean every(Boolean selecting(Nothing->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.

findSource Codeshared actual Null find(Boolean selecting(Nothing->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.

findLastSource Codeshared actual Null findLast(Boolean selecting(Nothing->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.

getSource Codeshared actual Null get(Object key)

Returns the value defined for the given key, or null if there is no value defined for the given key.

Refines Map.get ultimately refines Correspondence.get
getOrDefaultSource Codeshared actual Default getOrDefault<Default>(Object key, Default default)

Returns the item of the entry with the given key, or the given default if there is no entry with the given key in this map.

For maps with non-null items, the expression:

map.getOrDefault(key, def)

is equivalent to this common idiom:

map[key] else def

However, when the map has null items, getOrDefault() will preserve them.

Note that high-quality implementations of Map should refine this default implementation.

iteratorSource Codeshared actual Iterator<Nothing->Nothing> iterator()

An iterator for the elements belonging to this stream.

mapItemsSource Codeshared actual Map<Nothing,Nothing> mapItems<Result>(Result mapping(Nothing key, Nothing item))
given Result satisfies Object

Produces a map with the same Map.keys as this map. For every key, the item is the result of applying the given transformation function to its associated item in this map. This is a lazy operation, returning a view of this map.

Refines Map.mapItems
skipSource Codeshared actual {<Nothing->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.

takeSource Codeshared actual {<Nothing->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.

Inherited Methods
Methods inherited from: Object
Methods inherited from: Category<Element>
Methods inherited from: Collection<Element>
Methods inherited from: Correspondence<Key,Item>
Methods inherited from: Iterable<Element,Absent>
Methods inherited from: Map<Key,Item>