cast<R> method

Queue<R> cast <R>()

Makes this iterable useful as an Iterable<R>, if necessary.

Like retype except that this iterable is returned as-is if it is already an Iterable<R>.

It means that someIterable.cast<Object>().toList() is not guaranteed to return precisely a List<Object>, but it may return a subtype.

Implementation

Queue<R> cast<R>() {
  Queue<Object> self = this;
  return self is Queue<R> ? self : Queue.castFrom<E, R>(this);
}