List (Java SE 24 & JDK 24)
- Type Parameters:
E- the type of elements in this list
- All Superinterfaces:
Collection<E>,Iterable<E>,SequencedCollection<E>
- All Known Implementing Classes:
AbstractList,AbstractSequentialList,ArrayList,AttributeList,CopyOnWriteArrayList,LinkedList,RoleList,RoleUnresolvedList,Stack,Vector
-
Method Summary
voidInserts the specified element at the specified position in this list (optional operation).
booleanAppends the specified element to the end of this list (optional operation).
booleanInserts all of the elements in the specified collection into this list at the specified position (optional operation).
booleanAppends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).
default voidAdds an element as the first element of this collection (optional operation).
default voidAdds an element as the last element of this collection (optional operation).
voidclear()Removes all of the elements from this list (optional operation).
booleanReturns
trueif this list contains the specified element.booleanReturns
trueif this list contains all of the elements of the specified collection.static <E> List<E> Returns an unmodifiable List containing the elements of the given Collection, in its iteration order.
booleanCompares the specified object with this list for equality.
get(int index) Returns the element at the specified position in this list.
default EgetFirst()Gets the first element of this collection.
default EgetLast()Gets the last element of this collection.
inthashCode()Returns the hash code value for this list.
intReturns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
booleanisEmpty()Returns
trueif this list contains no elements.iterator()Returns an iterator over the elements in this list in proper sequence.
intReturns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
Returns a list iterator over the elements in this list (in proper sequence).
listIterator(int index) Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
static <E> List<E> of()Returns an unmodifiable list containing zero elements.
static <E> List<E> of(E e1) Returns an unmodifiable list containing one element.
static <E> List<E> of(E... elements) Returns an unmodifiable list containing an arbitrary number of elements.
static <E> List<E> of(E e1, E e2) Returns an unmodifiable list containing two elements.
static <E> List<E> of(E e1, E e2, E e3) Returns an unmodifiable list containing three elements.
static <E> List<E> of(E e1, E e2, E e3, E e4) Returns an unmodifiable list containing four elements.
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5) Returns an unmodifiable list containing five elements.
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6) Returns an unmodifiable list containing six elements.
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) Returns an unmodifiable list containing seven elements.
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) Returns an unmodifiable list containing eight elements.
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) Returns an unmodifiable list containing nine elements.
static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) Returns an unmodifiable list containing ten elements.
remove(int index) Removes the element at the specified position in this list (optional operation).
booleanRemoves the first occurrence of the specified element from this list, if it is present (optional operation).
booleanRemoves from this list all of its elements that are contained in the specified collection (optional operation).
default ERemoves and returns the first element of this collection (optional operation).
default ERemoves and returns the last element of this collection (optional operation).
default voidReplaces each element of this list with the result of applying the operator to that element (optional operation).
booleanRetains only the elements in this list that are contained in the specified collection (optional operation).
reversed()Returns a reverse-ordered view of this collection.
Replaces the element at the specified position in this list with the specified element (optional operation).
intsize()Returns the number of elements in this list.
default voidSorts this list according to the order induced by the specified
Comparator(optional operation).subList(int fromIndex, int toIndex) Returns a view of the portion of this list between the specified
fromIndex, inclusive, andtoIndex, exclusive.toArray()Returns an array containing all of the elements in this list in proper sequence (from first to last element).
<T> T[]toArray(T[] a) Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.
-
Method Details
-
size
-
isEmpty
-
contains
-
iterator
-
toArray
-
toArray
-
add
-
remove
-
containsAll
-
addAll
-
addAll
-
removeAll
-
retainAll
-
replaceAll
-
sort
-
clear
-
equals
-
hashCode
-
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
-
listIterator
-
listIterator
-
subList
-
spliterator
-
addFirst
-
addLast
-
getFirst
-
getLast
-
removeFirst
-
removeLast
-
reversed
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
copyOf
-