- All Superinterfaces:
Iterable<LongCursor>,LongCollection,LongContainer,RandomAccess
- All Known Implementing Classes:
LongArrayList,LongStack
@Generated(date="2024-06-04T15:20:17+0200",
value="KTypeIndexedContainer.java")
public interface LongIndexedContainer
extends LongCollection, RandomAccess
An indexed container provides random access to elements based on an
index. Indexes
are zero-based.-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long e1) Adds an element to the end of this container (the last index is incremented by one).longget(int index) intindexOf(long e1) Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.voidinsert(int index, long e1) Inserts the specified element at the specified position in this list.intlastIndexOf(long e1) Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.longremoveAt(int index) Removes the element at the specified position in this container and returns it.booleanremoveElement(long e1) Removes the first element that equalse1, returning whether an element has been removed.intremoveFirst(long e1) Removes the first element that equalse1, returning its deleted position or-1if the element was not found.longRemoves and returns the last element of this container.intremoveLast(long e1) Removes the last element that equalse1, returning its deleted position or-1if the element was not found.voidremoveRange(int fromIndex, int toIndex) Removes from this container all of the elements with indexes betweenfromIndex, inclusive, andtoIndex, exclusive.reverse()Reverses the elements in this container and returns this container.longset(int index, long e1) Replaces the element at the specified position in this list with the specified element.sort()Sorts the elements in this container and returns this container.stream()Returns this container elements as a stream.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
removeElement
boolean removeElement(long e1) Removes the first element that equalse1, returning whether an element has been removed. -
removeFirst
int removeFirst(long e1) Removes the first element that equalse1, returning its deleted position or-1if the element was not found. -
removeLast
int removeLast(long e1) Removes the last element that equalse1, returning its deleted position or-1if the element was not found. -
indexOf
int indexOf(long e1) Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. -
lastIndexOf
int lastIndexOf(long e1) Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. -
add
void add(long e1) Adds an element to the end of this container (the last index is incremented by one). -
insert
void insert(int index, long e1) Inserts the specified element at the specified position in this list.- Parameters:
index- The index at which the element should be inserted, shifting any existing and subsequent elements to the right.
-
set
long set(int index, long e1) Replaces the element at the specified position in this list with the specified element.- Returns:
- Returns the previous value in the list.
-
get
long get(int index) - Returns:
- Returns the element at index
indexfrom the list.
-
removeAt
long removeAt(int index) Removes the element at the specified position in this container and returns it.- See Also:
-
removeLast
long removeLast()Removes and returns the last element of this container. This container must not be empty. -
removeRange
void removeRange(int fromIndex, int toIndex) Removes from this container all of the elements with indexes betweenfromIndex, inclusive, andtoIndex, exclusive. -
stream
LongStream stream()Returns this container elements as a stream. -
sort
LongIndexedContainer sort()Sorts the elements in this container and returns this container. -
reverse
LongIndexedContainer reverse()Reverses the elements in this container and returns this container.
-