The AbstractQueue class in Java is a part of the Java Collection Framework and implements the Collection interface and the AbstractCollection class. It provides skeletal implementations of some Queue operations. The implementations in this class are appropriate when the base implementation does not allow null elements.
java.lang.Object ↳ java.util.AbstractCollection<E> ↳ Class AbstractQueue<E>
public abstract class AbstractQueue<E> extends AbstractCollection<E> implements Queue<E> Where E is the type of element maintained by this collection class.
Constructors in Java AbstractQueue:
- protected AbstractQueue(): The default constructor, but being protected, it doesn’t allow to create an AbstractQueue object.
Below is a sample program to illustrate AbstractQueue in Java:
AbstractQueue contains: [10, 20, 30, 40, 50]
Methods in Java AbstractQueue:
- add(E e): Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
- addAll(Collection extends E> c): Adds all of the elements in the specified collection to this queue.
- clear(): Removes all of the elements from this queue.
- element(): Retrieves, but does not remove, the head of this queue.
- remove(): Retrieves and removes the head of this queue.
- AbstractQueue add() method in Java with examples
- AbstractQueue element() method in Java with examples
- AbstractQueue remove() method in Java with examples
- AbstractQueue clear() method in Java with examples
- AbstractQueue addAll() method in Java with examples
- Java.util.LinkedList.poll(), pollFirst(), pollLast() with examples in Java
- Java lang.Long.highestOneBit() method in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java Deprecated API Scanner tool (jdepscan) in Java 9 with Examples
- Java.lang.Short toString() method in Java with Examples
- Java.util.Collections.rotate() Method in Java with Examples
- Java lang.Long.byteValue() method in Java with Examples
- Java.util.concurrent.RecursiveTask class in Java with Examples
- Java lang.Long.numberOfTrailingZeros() method in Java with Examples
- Java.util.function.IntPredicate interface in Java with Examples
- Java.util.concurrent.RecursiveAction class in Java with Examples
- Java lang.Long.numberOfLeadingZeros() method in Java with Examples
- Java.util.function.LongPredicate interface in Java with Examples
- Java lang.Long.lowestOneBit() method in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
AbstractQueue contains: [10, 20, 30, 40, 50] Head: 10 AbstractQueue: 
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.