Home > @i2analyze/notebook-sdk > data > IReadOnlyCollection
data.IReadOnlyCollection interface
A non-modifiable collection of objects.
Signature:
interface IReadOnlyCollection<V>
Introduced: version 1.0
Type Parameters
| Parameter | Type | Description |
|---|---|---|
| V | any | The type of the objects in the collection. |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| size | readonly |
number | Gets the number of objects in the collection. |
Methods
| Method | Description |
|---|---|
| [Symbol.iterator]() | Returns an object that can be used to iterate over all objects in the collection. |
| every(predicate) | Tests whether all objects in the collection satisfy a predicate. |
| filter(predicate) | Returns a new collection with all objects that satisfy a typeguard. |
| filter(predicate) | Returns a new collection with all objects that satisfy a predicate. |
| find(predicate) | Returns the first object in the collection that satisfies a predicate. |
| firstOrDefault(defaultValue) | Returns the first object in the collection, or a default object if the collection is empty. |
| includes(v) | Tests whether a collection includes an object. |
| isEmpty() | Executes firstOrDefault to see if the collection has any elements. If the collection has elements, returns false. Otherwise, returns true. |
| map(callbackfn) | Returns a new collection populated with the results of calling a function on each object. |
| reduce(callbackfn, initialValue) | Executes a reducer function on each object in the collection, to reduce it to a single object. |
| reduceRight(callbackfn, initialValue) | Executes a reducer function on each object in the collection in right-to-left order. |
| some(predicate) | Tests whether at least one object in the collection satisfies a predicate. |
| toArray() | Returns a new, read-only array that contains all the objects in the collection. |