| constructor | Creates an empty list. |
|---|---|
| constructor size/int filler/any | Creates a new List of the given size where every slot is filled with the given filler. |
| constructor size/int --initial/any= | Creates a new List of the given size where every slot is filled with the given initial value. |
| constructor size/int [block] | Creates a List and initializes each element with the result of invoking the block. |
[].chunk-from, chunk-to, and chunk-size, where chunk-size is always equal to chunk-to - chunk-from. The first invocation receives indexes for at most available elements. Subsequent invocations switch to max-available elements (which by default is the same as available).0 <= from <= to <= size.slice: JavaScript.sublist: Dart, Java,List, as the type of the returned object should match the one of this instance. As exception, classes that have multiple implementations (say a SmallCarList and LargeCarList) may switch type, *especially* if the individual types are not visible to the users.<, > and ==, to find the element.<, > and == to find the needle.
[1, 2].join ", " // "1, 2"
[1, 2].join ", ": "0x$(%02x it)" // "0x01, 0x02"
list[from..to]. Since both arguments are optional (as they have default values), it is valid to omit from or to.
list := [1, 2, 3, 4, 5]
sub := list[1..3] // A view into [2, 3]
sub[0] = 22
print list // => [1, 22, 3, 4, 5]
sub = list[..3] // A view into [1, 22, 3]
sub.sort --in-place // Sorts just the 3 values.
print sub // => [1, 3, 22]
print list // => [1, 3, 22, 4, 5]
sub2 := sub[1..]
print sub2 // => [3, 22]
sub2[1] = 499
print list // => [1, 3, 499, 4, 5]
sub3 := list[2..].copy // => Creates a copy of [499, 4, 5]
sub3[0] = 3 // This time only the copy is affected.
print sub3 // => [3, 4, 5]
print list // => [1, 3, 499, 4, 5]
O(n) and thus not efficient.O(n) and is thus not efficient for deletions that are not near the end of the list.O(n) and thus not efficient.O(n) and thus not efficient.a and b and should return:a < b,a == b, anda > b.