Java ArrayBlockingQueue clear() MethodThe clear() method of ArrayBlockingQueue class automatically withdraws all the elements from this priority queue. After calling this method, the queue will be empty. Syntax:Parameters:NA Specified By:The clear() method of class ArrayBlockingQueue is specified by clear() method in interface Collection Override:The clear() method of class ArrayBlockingQueue overrides the clear() method of class AbstractQueue Example 1Output: queue : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] After applying clear operation: queue : [] Example 2Output: Name = [aman, bhavika] After clearing the queue : Name = [] Next TopicJava-arrayblockingqueue-contains-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India