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

Breadcrumb

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

function DoubleEndedQueueInterface::addFirst

Inserts the specified element at the front of this queue if it is possible to do so immediately without violating capacity restrictions.

When using a capacity-restricted double-ended queue, it is generally preferable to use the `offerFirst()` method.

Parameters

T $element The element to add to the front of this queue.:

Return value

bool `true` if this queue changed as a result of the call.

Throws

RuntimeException if a queue refuses to add a particular element for any reason other than that it already contains the element. Implementations should use a more-specific exception that extends `\RuntimeException`.

1 method overrides DoubleEndedQueueInterface::addFirst()
DoubleEndedQueue::addFirst in vendor/ramsey/collection/src/DoubleEndedQueue.php

File

vendor/ramsey/collection/src/DoubleEndedQueueInterface.php, line 184

Class

DoubleEndedQueueInterface
A linear collection that supports element insertion and removal at both ends.

Namespace

Ramsey\Collection

Code

public function addFirst(mixed $element) : bool;
RSS feed
Powered by Drupal