Package com.carrotsearch.hppc
Interface ObjectIndexedContainer<KType>
- All Superinterfaces:
Iterable<ObjectCursor<KType>>
,ObjectCollection<KType>
,ObjectContainer<KType>
,RandomAccess
- All Known Implementing Classes:
ObjectArrayList
,ObjectStack
@Generated(date="2023-09-14T00:00:00+0000",
value="KTypeIndexedContainer.java")
public interface ObjectIndexedContainer<KType>
extends ObjectCollection<KType>, RandomAccess
An indexed container provides random access to elements based on an
index
. Indexes are zero-based.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an element to the end of this container (the last index is incremented by one).get
(int index) int
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.void
Inserts the specified element at the specified position in this list.int
lastIndexOf
(KType 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.remove
(int index) Removes the element at the specified position in this container and returns it.int
removeFirst
(KType e1) Removes the first element that equalse1
, returning its deleted position or-1
if the element was not found.int
removeLast
(KType e1) Removes the last element that equalse1
, returning its deleted position or-1
if the element was not found.void
removeRange
(int fromIndex, int toIndex) Removes from this container all of the elements with indexes betweenfromIndex
, inclusive, andtoIndex
, exclusive.Replaces the element at the specified position in this list with the specified element.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
removeFirst
Removes the first element that equalse1
, returning its deleted position or-1
if the element was not found. -
removeLast
Removes the last element that equalse1
, returning its deleted position or-1
if the element was not found. -
indexOf
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
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
Adds an element to the end of this container (the last index is incremented by one). -
insert
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
Replaces the element at the specified position in this list with the specified element.- Returns:
- Returns the previous value in the list.
-
get
- Returns:
- Returns the element at index
index
from the list.
-
remove
Removes the element at the specified position in this container and returns it. -
removeRange
void removeRange(int fromIndex, int toIndex) Removes from this container all of the elements with indexes betweenfromIndex
, inclusive, andtoIndex
, exclusive.
-