Java Reference
In-Depth Information
Swaps the i th and j th elements of the given list. This can be
done efficiently inside the collection.
public static <T> void fill(List<? super T> list, T elem)
Replaces each element of list with elem .
public static <T> void copy(List<? super T> dest, List<? extends T>
src)
Copies each element to dst from src . If dst is too small to con-
tain all the elements, throws IndexOutOfBoundsException . You
can use a sublist for either dst or src to copy only to or from
parts of a list.
public static <T> List<T> nCopies(int n, T elem)
Returns an immutable list that contains n elements, each of
which is elem . This only requires storing one reference to elem ,
so n can be 100 and the returned list will take the same
amount of space it would if n were one.
public static int indexOfSubList(List<?> source, List<?> target)
Returns the index of the start of the first sublist of source that
is equal to target .
public static int lastIndexOfSubList(List<?> source, List<?> target)
Returns the index of the start of the last sublist of source that
is equal to target .
There are also methods for sorting and searching lists:
public static <T extends Comparable<? super T>> void sort(List<T>
list)
 
Search WWH ::




Custom Search