LinkedTransferQueue remainingCapacity() method in Java with Examples Last Updated : 04 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The Java.util.concurrent.LinkedTransferQueue.remainingCapacity(): method always returns Integer.MAX_VALUE as this kind of queue is not capacity constrained. Syntax public int remainingCapacity() Parameters: This method does not take in any parameters. Returns: This method returns only one value i.e. Integer.MAX_VALUE. Below examples illustrates the LinkedTransferQueue.remainingCapacity() method: Example 1: Java // Java program to illustrate // LinkedTransferQueue.remainingCapacity() method import java.util.concurrent.LinkedTransferQueue; class GFG { public static void main(String args[]) { // create object of LinkedTransferQueue // using LinkedTransferQueue() constructor LinkedTransferQueue<Integer> LTQ = new LinkedTransferQueue<Integer>(); // Add numbers to end of LinkedTransferQueue LTQ.add(7855642); LTQ.add(35658786); LTQ.add(5278367); LTQ.add(74381793); // print Deque System.out.println("Linked Transfer Queue1: " + LTQ); // print the remaining capacity // using remainingCapacity() method System.out.println(LTQ.remainingCapacity()); } } Output:Linked Transfer Queue1: [7855642, 35658786, 5278367, 74381793] 2147483647 Example 2: Java // Java program to illustrate // LinkedTransferQueue.remainingCapacity() method import java.util.concurrent.LinkedTransferQueue; class GFG { public static void main(String args[]) { // create object of LinkedTransferQueue // using LinkedTransferQueue() constructor LinkedTransferQueue<String> LTQ = new LinkedTransferQueue<String>(); // Add numbers to end of LinkedTransferQueue LTQ.add("Geeks"); LTQ.add("For"); LTQ.add("Geeks"); LTQ.add("GeeksForGeeks"); // print Deque System.out.println("Linked Transfer Queue1: " + LTQ); // print the remaining capacity // using remainingCapacity() method System.out.println(LTQ.remainingCapacity()); } } Output:Linked Transfer Queue1: [Geeks, For, Geeks, GeeksForGeeks] 2147483647 Comment More infoAdvertise with us Next Article LinkedTransferQueue remainingCapacity() method in Java with Examples P psil123 Follow Improve Article Tags : Java Java-Collections Java - util package Java-Functions Java-LinkedTransferQueue +1 More Practice Tags : JavaJava-Collections Similar Reads LinkedTransferQueue retainAll() method in Java with Examples The retainAll() method of java.util.concurrent.LinkedTransferQueue is an in-built function in Java which is used to retain all the elements in this queue which are common to both i.e. the specified collection and this queue. All other elements which are not common are removed from this queue. Syntax 3 min read LinkedTransferQueue removeIf() method in Java with Examples The removeIf() method of java.util.concurrent.LinkedTransferQueue is an in-built function is Java which is used to remove all of the elements of this queue that satisfies a given predicate filter which is passed as a parameter to the method. Syntax: public boolean removeIf(Predicate filter) Paramete 2 min read LinkedTransferQueue transfer() method in Java with Examples The transfer() method of class LinkedTransferQueue is an inbuilt function in Java which is generally used to transfer an element to a thread which is waiting to receive it, if there is no thread waiting then it will wait till a thread comes to waiting state as soon as waiting thread arrives element 2 min read LinkedTransferQueue removeAll() method in Java with Examples The removeAll() method of java.util.concurrent.LinkedTransferQueue is an in-built function is Java which is used to remove from this queue all of its elements that are contained in the specified collection. Syntax: public boolean removeAll(Collection c) Parameters: This method takes collection c as 3 min read LinkedTransferQueue tryTransfer() method in Java with Examples The tryTransfer() method of class LinkedTransferQueue is an inbuilt function in Java which is generally used to transfer an element to a thread which is waiting to receive it, if in case there is no thread waiting then it will terminate without adding element into the queue or you can also make it w 5 min read LinkedTransferQueue forEach() method in Java with Examples The forEach() method of Java.util.concurrent.LinkedTransferQueue is an in-built function in Java which is used to traverse each element in this queue. Syntax: public void forEach(Consumer<E> action) Parameters: This method takes a parameter action which represents the action to be performed fo 2 min read LinkedBlockingQueue remainingCapacity() method in Java The remainingCapacity() method of LinkedBlockingQueue returns the number of more elements that can be added to LinkedBlockingQueue without blocking. The Capacity returned arises three cases: If remaining Capacity is Zero, then no more elements can be added to the LinkedBlockingQueue.If remaining Cap 3 min read LinkedBlockingDeque retainAll() method in Java with Examples The retainAll() method of LinkedBlockingDeque is an in-built function is Java which is used to remove from this deque all of its elements that are contained in the specified collection. That means, all the common elements these two collections are removed from this deque. Syntax: public boolean reta 2 min read DelayQueue remainingCapacity() method in Java with Examples The remainingCapacity() method of DelayQueue always returns Integer.MAX_VALUE because a DelayQueue is not capacity constrained. That means, irrespective of the size of the DelayQueue it returns same result, i.e. Integer.MAX_VALUE. Syntax: public int remainingCapacity () Return Value: The function re 2 min read LinkedBlockingDeque remainingCapacity() method in Java The remainingCapacity() method of LinkedBlockingDeque returns the number of additional elements that this deque can ideally (in the absence of memory or resource constraints) accept without blocking. remainingCapacity() = final_size() - current_size() Syntax: public int remainingCapacity() Parameter 2 min read Like