//Adds specific data to rear of queue public void Enqueue(int data) { LinkListNode node = new LinkListNode(data); if (IsEmpty()) { _front = node; } else { _rear.setNext(node); } _rear = node; _length++; }
//Removes the data from the front of the queue public int Dequeue() { if (IsEmpty()) { throw new Exception("Empty Queue"); } int result = _front.getData(); _front = _front.GetNext(); _length--; if (IsEmpty()) { _rear = null; } return(result); }
//Creates an empty queue public LinkedListImplementation() { _length = 0; _front = _rear = null; }
public void setNext(LinkListNode next) { this.next = next; }