Queue CLASS

A queue only allows data access based on first-in-first-out (FIFO) order. Similar to List, it's self-scalable.

Parent Class

Parent Interfaces

All Members


TypeNameSignature
constructorQueuepublic Queue()
methoddequeuepublic var dequeue()
methodenqueuepublic void enqueue(var)
methodsizepublic int size()

Constructors


public Queue()

Create a new queue.


Methods


public var dequeue()

Remove an element from the head of queue.

Returns

  • The element to remove; null if the queue is empty. It cannot differentiate between empty queue and null element.

public void enqueue(var ele)

Add a new element to the tail of queue.

Parameters

  • ele The new element to add. Can be null.

public int size()

Get the current size of the queue.

Returns

  • The size of queue.