javascript-collections-framework
    Preparing search index...

    Function unmodifiableSequencedCollection

    • Returns a read-only view of a sequenced collection: as unmodifiableCollection, with the ends (getFirst, getLast) and a reversed view. It compares by identity.

      When collection is already a view this function returns (printed as UnmodifiableSequencedCollection), it is returned unchanged. When it is any other unmodifiable view or immutable collection from this copy of the library, the new view reads that collection's source instead, and entries it hands out stay read-only, so read-only wrappers never nest.

      Time: O(1); each operation costs what the collection's costs.

      Type Parameters

      • E

      Parameters

      Returns ReadonlySequencedCollection<E>

      collection itself, or an unmodifiable view printed as UnmodifiableSequencedCollection.

      TypeError when collection is not a sequenced collection from this library.

      const deque = new ArrayDeque([1, 2, 3])
      unmodifiableSequencedCollection(deque).getLast() // 3