JavaAlgorithms/DataStructures/Queues
2021-10-06 14:15:45 +03:00
..
GenericArrayListQueue.java Formatted with Google Java Formatter 2020-10-24 10:23:28 +00:00
LinkedQueue.java Formatted with Google Java Formatter 2020-10-24 10:23:28 +00:00
PriorityQueues.java Formatted with Google Java Formatter 2020-10-24 10:23:28 +00:00
Queues.java Formatted with Google Java Formatter 2020-10-24 10:23:28 +00:00
README.md Add README.md for Queue (#2483) 2021-10-06 14:15:45 +03:00

Queue

  • The Queue interface is present in the java.util package.
  • It is an ordered list of objects that follows the FIFO (First-In-First-Out) principle.

Characteristics of a Queue

  • The Queue is used to insert elements at the end of the queue and removes elements from the beginning of the queue.
  • It supports all methods of Collection interface including insertion, deletion etc.
  • LinkedList, ArrayBlockingQueue and PriorityQueue are the most commonly used implementations.

Declaration

Queue<Obj> queue = new PriorityQueue<Obj> ();

Important operations

Operations Description
Enqueue Adds an item to the queue
Dequeue Removes an item from the queue
Front Gets the front item from the queue
Rear Gets the last item from the queue