Skip to main content

abstract class NonEmptyBase<E>

A shared base class for non-empty collection instances. It implements the common Collection.NonEmpty API and is reused across different non-empty collection types.

Type parameters​

NameDescription
Ethe element type
sealed

Properties​

_NonEmptyType​

undocumented

Definition​

readonly _NonEmptyType: unknown;

isEmpty​

Returns false since the collection is known to be non-empty.

Definition​

get isEmpty(): false;

Methods​

[Symbol.iterator]​

Returns a fast iterator over the elements of the collection.

Definition​

[Symbol.iterator](): FastIterator<E>;

asNormal​

Returns this typed as a possibly-empty collection type.

Definition​

asNormal(): any;

assumeNonEmpty​

Returns this, since the collection is already known to be non-empty.

Definition​

assumeNonEmpty(): this;

nonEmpty​

Returns true and instructs the compiler to treat the instance as non-empty.

Definition​

nonEmpty(): this is this['_NonEmptyType'];

stream​

Returns a non-empty Stream containing all elements of the collection.

Definition​

abstract stream(): Stream.NonEmpty<E>;