publicinterfaceList<E>
extendsCollection<E>
Object[] toArray()
<T> T[] toArray(T[] a)
如果a长度小了,分配新的数组返回。过大,在a后面补null(list里面不能包含null时才行)
toArray(newObject[0])等同于toArray()
defaultvoidreplaceAll(UnaryOperator<E> operator) {
Objects.requireNonNull(operator);
final ListIterator<E> li = this.listIterator();
while (li.hasNext()) {
li.set(operator.apply(li.next()));
}
}
@SuppressWarnings({"unchecked", "rawtypes"})
defaultvoid sort(Comparator<? super E> c) {
Object[] a = this.toArray();
Arrays.sort(a, (Comparator) c);
ListIterator<E> i = this.listIterator();
for (Object e : a) {
i.next();
i.set((E) e);
}
}
//Note that it is generally necessary to override the hashCode method whenever this method is overriddenpublicinthashCode(){
int hashCode = 1;
for (E e : list)
hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
return hashCode;
}
E set(int index,
E element)
Replaces the element at the specified position in this list with the specified element (optional operation).
void add(int index, E element)
E remove(int index)
int indexOf(Object o)
int lastIndexOf(Object o)
ListIterator<E> listIterator()
ListIterator<E> listIterator(int index)
List<E> subList(int fromIndex, int toIndex)
default Spliterator<E> spliterator()