newLinkedList( item... )

Returns a new modifiable list, initialized with the specified items.

The list is implemented as a doubly-linked list, where each item in the list has a pointer to the next and previous item(i.e. linked). As you might expect there are a couple of trade offs to this style of list. Using an linked list means that adding items to the list should always be fast, however accessing specific(i.e. random) items in the array is potentially slow. Random access is slow because the links have to be followed one at a time from the start or end to find the required element.

A simple example is always useful, e.g. to construct a new list with a variety of items:

:-) newLinkedList( 1,2,3,4, "hello", <xml /> );
There is 1 result
[1, 2, 3, 4, hello, <xml />]
      

and another example showing the list is indeed modifiable:

:-) var aList = newLinkedList( 1,2,3,4, "hello", <xml /> );
:-) aList[ 3 ] := "changed";
There are 0 results
:-) aList;
There is 1 result
[1, 2, changed, 4, hello, <xml />]
      

Notes

If you know that you will access individual elements often, but will not add many items to the array, consider using newArrayList instead.

If you know that you will never need to modify the list, consider using newLiteList instead.