Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DoubleEndedQueue.php

function DoubleEndedQueue::lastElement

Return value

T the tail of this queue.

Throws

NoSuchElementException if this queue is empty.

Overrides DoubleEndedQueueInterface::lastElement

File

vendor/ramsey/collection/src/DoubleEndedQueue.php, line 138

Class

DoubleEndedQueue
This class provides a basic implementation of `DoubleEndedQueueInterface`, to minimize the effort required to implement this interface.

Namespace

Ramsey\Collection

Code

public function lastElement() : mixed {
    return $this->peekLast() ?? throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.');
}
RSS feed
Powered by Drupal