W3cubDocs

/Dart 2

castFrom<S, T> method

Queue<T> castFrom <S, T>(Queue<S> source)

Adapts source to be a Queue<T>.

Any time the queue would produce an element that is not a T, the element access will throw.

Any time a T value is attempted stored into the adapted queue, the store will throw unless the value is also an instance of S.

If all accessed elements of source are actually instances of T, and if all elements stored into the returned queue are actually instance of S, then the returned queue can be used as a Queue<T>.

Implementation

static Queue<T> castFrom<S, T>(Queue<S> source) =>
    new CastQueue<S, T>(source);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-collection/Queue/castFrom.html