description

# cast<R> method

Queue<R> cast <R>()
override

Provides a view of this queue as a queue of `R` instances, if necessary.

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

Elements added to the queue (e.g., by using addFirst or addAll) must be instance of `R` to be valid arguments to the adding function, and they must be instances of `E` as well to be accepted by this queue as well.

## Implementation

    Queue<R> cast<R>();