![]() |
VOOZH | about |
The checkedQueue() method of Java Collections is a method that returns a dynamically and typesafe view of the given Queue. Any attempt to insert an element of the wrong type will result in an immediate ClassCastException.
Syntax:
public static <E> Queue<E> checkedQueue(Queue<E> queue, Class<E> type)
Parameters:
Return Type: This method will return the dynamically and typesafe view of the given Queue.
Exceptions:
Example 1: Create a type-safe view of the List using checkedQueue() Method
[C, Java/jsp, Python, R]
Example 2:
[1, 21, 56, 23]