Java ArrayBlockingQueue Spliterator() Method7 Jan 2025 | 2 min read The Spliterator() method of Java ArrayBlockingQueue class returns a Spliterator over the elements in this ArrayBlockingQueue. Syntax:Parameters:NA Specified By:The Spliterator () method of ArrayBlockingQueue class is specified by:
Return Value:The Spliterator () method returns a Spliterator over the elements in this ArrayBlockingQueue. Example 1Output: 1 Name - Reema 2 Name - Varun 3 Name - Sukla Example 2Output: 1 Roll No = 15cs1029 Name = Reema panda Marks = 21 2 Roll No = 15cs1012 Name = Geetanjali Sharma Marks = 26 3 Roll No = 15cs1011 Name = Himanshu Bhardwaj Marks = 27 Example 3Output: 1 Lower case = reema 1 Upper case = REEMA 2 Lower case = bhavika 2 Upper case = BHAVIKA 3 Lower case = chehak 3 Upper case = CHEHAK 4 Lower case = chandan 4 Upper case = CHANDAN Next TopicJava-arrayblockingqueue-take-method |
The put() method of ArrayBlockingQueue adds the defined element at the tail of this queue. It waits till the space becomes available if queue is full. Syntax: public void put(E e) throws InterruptedException Parameters: e - This is the element to be added. Specified By: The put() method of ArrayBlockingQueue class...
3 min read
The removeIf() method of Java ArrayBlockingQueue class removes the elements of the ArrayBlockingQueue that satisfies the given predicate filter. Syntax: public boolean removeIf(Predicate<? Super E> filter) Parameters: The parameter filter is a predicate which returns true for the elements to be removed. Specified By: The removeIf() method of ArrayBlockingQueue class is...
3 min read
The forEach() method of Java ArrayBlockingQueue class executes the specified action for each element of Iterable till all the elements are processed or the action throws an exception. Syntax: public void forEach(Consumer<? super E> action) Parameters: action - This is the action to be performed for every element. Specified By: The...
4 min read
The retainAll() method of Java ArrayBlockingQueue class retains only the elements of the ArrayBlockingQueue that are contained in the specified collection and removes rest of the elements. Syntax: public boolean retainAll(Collection<?> c) Parameters: Here, the parameter c is the collection containing elements to be retained in the ArrayBlockingQueue collection. Specified...
3 min read
The size() method of Java ArrayBlockingQueue class returns the total number of elements in the ArrayBlockingQueue. Syntax: public int size() Parameters: NA Specified By: The size() method of ArrayBlockingQueue class is specified by: Size in interface Collection<E>. Size in class AbstractCollection<E> Return Value: The size() method returns the total number of elements in this queue. Example...
3 min read
The peek() method of Java ArrayBlockingQueue class retrieves the head of this queue, but doesn't remove it. The method returns null if this queue is empty. Syntax: public E peek() Parameters: NA Specified By: The peek() method of ArrayBlockingQueue class is specified by peek() method in interface Queue. Return Value: The peek() method...
3 min read
The toArray() method of Java ArrayBlockingQueue returns an array containing all the elements of the ArrayBlockingQueue, in proper sequence. The syntax of toArray() returns an array where the runtime of the returned array is that of the specified array, and if the queue fits in...
6 min read
ArrayBlockingQueue is a bounded blocking queue which orders the element in FIFO(first-in-first-out). In this queue, new elements are inserted at the tail of this queue and the elements are retrieved from the head of this queue. ArrayBlockingQueue class implements all the optional methods of the Collection...
3 min read
The poll() method of ArrayBlockingQueue class retrieves the head of this queue awaiting till the specified time if essential for an element to be available, and also removes it. The method returns null if this queue is empty. Syntax: 1.public E poll() 2.public E poll(long timeout,TimeUnit unit)throws InterruptedException Parameters: NA timeout...
3 min read
The iterator() method of ArrayBlockingQueue class returns an iterator across the elements of this queue in a sequential manner. The elements returned will follow order from first (head) to last (tail). Syntax: public Iterator<E> iterator() Parameters: NA Specified By: The iterator() method of ArrayBlockingQueue class is specified by: iterator() method in interface Collection<E>. iterator()...
3 min read
We request you to subscribe our newsletter for upcoming updates.
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