Skip to content

Latest commit

 

History

History
25 lines (13 loc) · 501 Bytes

README.md

File metadata and controls

25 lines (13 loc) · 501 Bytes

Immutable Queue

An immutable queue does not modify the values of an existing queue, but always recreates the queue and return a new queue.

Check out the Application.java for use cases.

Instantiate queue

Queue<Integer> queue = new ImmutableQueue.EmptyQueue<Integer>();

Add item to the queue

queue = queue.enQueue(1);

Retrieve first item on the queue

queue.head();

Remove first item from the queue

queue = queue.deQueue();

Check if queue is empty

queue.isEmpty()