Java ArrayBlockingQueue remainingCapacity() MethodThe remainingCapacity() method of Java ArrayBlockingQueue class returns the capacity of the elements that this queue can accept without blocking. Syntax:Parameters:NA Specified By:The remainingCapacity () method of ArrayBlockingQueue class is specified by remainingCapacity in interface BlockingQueue Return Value:The remainingCapacity () method returns the remaining capacity of the queue. Example 1Output: Queue : [1, 2, 3, 4, 5, 6] Remaining capacity of the queue = 4 Example 2Output: Register your name quickly in JavaTpoint. As only 7 seats are left Example 3Output: Enter capacity : 5 Remaining capacity : 5 Element : 56 Remaining capacity : 4 Element : 78 Remaining capacity : 3 Element : 55 Remaining capacity : 2 Element : 9 Remaining capacity : 1 Element : 76 Queue = [56, 78, 55, 9, 76] Next TopicJava-arrayblockingqueue-remove-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