Class: List

Lists are ordered indexed dense collections, much like a JavaScript Array.

Please refer to the full documentation on the Immutable.js website.

Constructor

new PSPDFKit.Immutable.List(values)

Ordered, indexed, dense collections, like JavaScript Arrays.

Parameters:
Name Type Description
values Array

A plain Javascript array from which the list can be generated.

Examples

Create a list from an array

const list = PSPDFKit.Immutable.List([1, 2]);

Add a new item to the end of the list

list = list.push(3); // => Immutable.List[1, 2, 3]

Remove an item by it's index

list = list.delete(0); // => Immutable.List[2, 3]

Modify all items in the list using an ES2015 arrow function

list = list.map(v => v * 2); // => Immutable.List[4, 6]

Reverse the List

list = list.reverse(); // => Immutable.List[6, 4]