castFrom< S, T> method
Adapts source
to be an Iterable<T>
.
Any time the iterable would produce an element that is not a T
,
the element access will throw. If all elements of source
are actually
instances of T
, or if only elements that are actually instances of T
are accessed, then the resulting iterable can be used as an Iterable<T>
.
Implementation
static Iterable<T> castFrom<S, T>(Iterable<S> source) =>
new CastIterable<S, T>(source);