javascript-collections-framework
    Preparing search index...

    Function copyOfList

    • Returns an immutable list of the elements of elements, in iteration order. The source is read once; later changes to it do not show through. Given a list this function or listOf returned, it may return that list.

      Time: O(n) for n elements.

      Type Parameters

      • E

      Parameters

      • elements: Iterable<E>

        The elements.

      Returns ReadonlyList<E>

      An immutable list.

      TypeError when elements is not iterable (null and undefined included).

      copyOfList(new Set([3, 1, 2])) // ImmutableList(3) [3, 1, 2]
      copyOfList(Array(3).fill(0)) // ImmutableList(3) [0, 0, 0]