element method

E element()

Retrieves, but does not remove, the head of this queue.

Throws NoGuaranteeException if this queue is empty.

Example:

final queue = LinkedQueue<int>();
queue.offer(42);
final head = queue.element(); // 42

Implementation

E element() {
  if (_head == null) {
    throw NoGuaranteeException('Queue is empty');
  }
  return _head!.data;
}