cast<R> method

KtIterable<R> cast<R>()

Provides a view of this KtIterable as an iterable of R instances.

If this KtIterable only contains instances of R, all operations will work correctly. If any operation tries to access an element that is not an instance of R, the access will throw a TypeError instead.

When the returned KtIterable creates a new object that depends on the type R, e.g., from toList, it will have exactly the type R.

Implementation

KtIterable<R> cast<R>() => _CastKtIterable<T, R>(this);