This interface is an abstract interface for various list classes that inherit from the collection interface.
Public interface List<e> extends collection<e>
This is the basic information for the interface.
int size ();
This method returns the number of elements in the list.
Boolean isEmpty ();
This method determines whether the list is empty.
Boolean contains (Object O);
This method determines whether an element is included.
Iterator<e> Iterator ();
Gets the method of the iterator.
Object[] ToArray ();
The method of converting a list to an array.
<T> t[] ToArray (t[] a);
The method of converting a list to a generic array.
Boolean Add (e e);
The method for adding elements.
Boolean remove (Object O);
The method to delete the element.
Boolean containsall (collection<?> c);
A method that determines whether to include all elements of a parameter collection.
Boolean AddAll (collection<? extends e> c);
Adds all the elements in the parameter collection to this list.
Boolean addall (int index, COLLECTION<? extends e> c);
Adds an element from the parameter collection to the specified subscript at the beginning of this list.
Boolean RemoveAll (collection<?> c);
Removes the method for all elements in the parameter collection from this list.
Boolean retainall (collection<?> c);
Remove the element that is not the same as all elements of the list and the parameter collection, just the opposite of the method above.
default void ReplaceAll (unaryoperator<e> operator) {
Objects.requirenonnull (operator);
Final listiterator<e> li = This.listiterator ();
while (Li.hasnext ()) {
Li.set (Operator.apply (Li.next ()));
}
}
The default method, which is an element substitution, is prepared for the lambda expression. The parameter is the interface of a unary operator.
First, determine if the parameter is empty. Then get the list iterator, start the iteration, let the arguments operate, and then assign the values with iterators. I can read this.
default void 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);
}
}
The default method, which is sorted. First convert this list to an array, and then use the arguments and arrays classes to sort the converted arrays. Then get the list iterator and iterate over the array to place each element of the array in the appropriate position with an iterator.
void Clear ();
The method that clears all elements.
Boolean equals (Object O);
The method of judging whether it is equal.
int hashcode ();
The method that computes the hash value.
E get (int index);
Gets the method that specifies the location element.
e Set (int index, e element);
The method that assigns a value to the element at the specified location.
void Add (int index, E element);
The method for adding elements to the specified location.
E Remove (int index);
Removes the method for the specified location element.
int indexOf (Object o);
Returns the method where the parameter element is located.
int lastIndexOf (Object o);
The method that returns the position of the last occurrence of the parameter element.
Listiterator<e> Listiterator ();
Gets the method of the list iterator.
listiterator<e> listiterator (int index);
Gets the list iterator method that begins the iteration from the specified subscript.
list<e> sublist (int fromIndex, int toindex);
The method of intercepting list.
Default Spliterator<e> spliterator () {
Return Spliterators.spliterator (this, spliterator.ordered);
}
The default method, which returns Spliterator, is an API that divides a collection into chunks, processes the blocks in parallel, and joins the processing results together.
At this point the source of the list interface reading finished
Common learning Java source code--Data Structure--list interface