queue is collection of objects that are inserted and removed according to the firstin first-out (fifoprinciple that iselements can be inserted at any timebut only the element that has been in the queue the longest can be removed at any time we usually say that elements enter queue at the rear and are removed from the front the metaphor for this terminology is line of people waiting to get on an amusement park ride people waiting for such ride enter at the rear of the line and get on the ride from the front of the line the queue abstract data type formallythe queue abstract data type defines collection that keeps objects in sequencewhere element access and deletion are restricted to the first element in the sequencewhich is called the front of the queueand element insertion is restricted to the end of the sequencewhich is called the rear of the queue this restriction enforces the rule that items are inserted and deleted in queue according to the first-in first-out (fifoprinciple the queue abstract data type (adtsupports the following two fundamental methodsenqueue( )insert element at the rear of the queue dequeue()remove and return from the queue the object at the frontan error occurs if the queue is empty additionallysimilar to the case with the stack adtthe queue adt includes the following supporting methodssize()return the number of objects in the queue isempty()return boolean value that indicates whether the queue is empty front()returnbut do not removethe front object in the queuean error occurs if the queue is empty example the following table shows series of queue operations and their effects on an initially empty queue of integer objects for simplicitywe use integers instead of integer objects as arguments of the operations operation output front rear