An ordered collection of objects. The user of a List has precise control over
where in the list each element is inserted. The user can access elements by
their integer index (position in the list), and search for elements in the
list. Lists are zero based similar to arrays. Unlike sets, lists allow
duplicate elements.
Converts all elements of the list to a string by calling the toString() method and then concatenates them together, with the separator string between elements.
Creates and returns a new List that is the result of concatenating this
list with each of the specified values. This list itself is unmodified.
If any of the specified values is itself an array or a Collection, then
the elements of that Collection or array are appended to the new list
rather than the object itself.
Parameters:
values - one or more objects to concatenate.
Returns:
a new List that is the result of concatenating this
list with each of the specified values.
Converts all elements of the list to a string by calling the toString()
method and then concatenates them together, with the separator string
between elements. If null is passed, then the comma character is used as
a separator.
Parameters:
separator - The separator string. May be null in which case the comma character is used.
Returns:
The string that results from converting each element of the list
to a string and then concatenating them together, with the
separator string between elements.
Returns a slice, or sublist, of this list. The returned list contains the
element specified by from and all subsequent elements up to
the end of this list.
Parameters:
from - The index at which the slice is to begin. If negative, this argument specifies a position measured from the end of this list. That, -1 indicates the last element, -2 indicates the next from the last element, and so on.
Returns:
A new List that contains the elements of this list from the
element specified by from up to the end of this
list.
Returns a slice, or sublist, of this list. The returned list contains the
element specified by from and all subsequent elements up to,
but not including, the element specified by to.
Parameters:
from - The index at which the slice is to begin. If negative, this argument specifies a position measured from the end of this list. That, -1 indicates the last element, -2 indicates the next from the last element, and so on.
to - The index immediately after the end of the slice. If this argument is negative, it specifies an element measured from the end of this list.
Returns:
A new List that contains the elements of this list from the
element specified by from up to, but not including,
the element specified by to.
sort()
sort(): void
Sorts the elements of the list based on their natural
order.
This sort is guaranteed to be stable: equal elements will
not be reordered as a result of the sort.
Sorts the elements of a list. The order of the elements is
determined with a comparator (see PropertyComparator) or with the help
of the given function. The function must take two parameters and return
a value <0 if the first parameter is smaller than the second, a value
of 0 if both are equal and a value if >0 if the first one is greater
than the second parameter.
This sort is guaranteed to be stable: equal elements will
not be reordered as a result of the sort.
Parameters:
comparator - an instance of a PropertyComparator or a comparison function