VOOZH about

URL: https://www.geeksforgeeks.org/java/linkedtransferqueue-put-method-in-java/

⇱ LinkedTransferQueue put() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

LinkedTransferQueue put() method in Java

Last Updated : 14 Sep, 2018
The java.util.concurrent.LinkedTransferQueue.put() method is an in-built function in Java which is used to insert an element in this queue. It waits till the space becomes available if queue is full. Syntax:
LinkedTransferQueue.put(E e)
Parameters: The function accepts a single parameter e i.e. the element to be inserted. Return Value: The function does not return anything. Exception: The function shows NullPointerException when the specified element is Null. Below programs illustrate the LinkedTransferQueue.put() method: Program 1: Inserting Integers in the queue.
Output:
The elements in the queue are:
10 11 12 13 14 15
Program 2: Adding String in the queue.
Output:
The elements in the queue are:
alex bob chuck drake erick
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/LinkedTransferQueue.html#put(E)
Comment