Top Description Methods
com.carrotsearch.hppc

public Interface ObjectIndexedContainer<KType>

extends ObjectCollection<KType>, RandomAccess
Known Direct Implementers
com.carrotsearch.hppc.ObjectArrayList
Annotations
@Generated:KTypeIndexedContainer.java
date:2024-06-04T15:20:17+0200
Imports
java.util.RandomAccess, java.util.stream.Stream

An indexed container provides random access to elements based on an index. Indexes are zero-based.

Method Summary

Modifier and TypeMethod and Description
public void
add(KType e1)

Adds an element to the end of this container (the last index is incremented by one).

public KType

Returns:

Returns the element at index index from the list.
get
(int index)

public int
indexOf(KType 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.

public void
insert(int
The index at which the element should be inserted, shifting any existing and subsequent elements to the right.
index
,
KType e1)

Inserts the specified element at the specified position in this list.

public 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.

public KType
removeAt(int index)

Removes the element at the specified position in this container and returns it.

public boolean
removeElement(KType e1)

Removes the first element that equals e1, returning whether an element has been removed.

public int
removeFirst(KType e1)

Removes the first element that equals e1, returning its deleted position or -1 if the element was not found.

public int
removeLast(KType e1)

Removes the last element that equals e1, returning its deleted position or -1 if the element was not found.

public KType
removeLast()

Removes and returns the last element of this container.

public void
removeRange(int fromIndex, int toIndex)

Removes from this container all of the elements with indexes between fromIndex, inclusive, and toIndex, exclusive.

public ObjectIndexedContainer<KType>
reverse()

Reverses the elements in this container and returns this container.

public KType

Returns:

Returns the previous value in the list.
set
(int index, KType e1)

Replaces the element at the specified position in this list with the specified element.

public ObjectIndexedContainer<KType>
sort()

Sorts the elements in this container and returns this container.

public Stream<KType>
stream()

Returns this container elements as a stream.

Inherited from com.carrotsearch.hppc.ObjectCollection:
clearreleaseremoveAllremoveAllremoveAllretainAllretainAll

Method Detail

addback to summary
public void add(KType e1)

Adds an element to the end of this container (the last index is incremented by one).

getback to summary
public KType get(int index)
Returns:KType

Returns the element at index index from the list.

indexOfback to summary
public int indexOf(KType 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.

insertback to summary
public void insert(int index, KType e1)

Inserts the specified element at the specified position in this list.

Parameters
index:int

The index at which the element should be inserted, shifting any existing and subsequent elements to the right.

lastIndexOfback to summary
public 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.

removeAtback to summary
public KType removeAt(int index)

Removes the element at the specified position in this container and returns it.

See Also
removeFirst, removeLast, removeAll
removeElementback to summary
public boolean removeElement(KType e1)

Removes the first element that equals e1, returning whether an element has been removed.

removeFirstback to summary
public int removeFirst(KType e1)

Removes the first element that equals e1, returning its deleted position or -1 if the element was not found.

removeLastback to summary
public int removeLast(KType e1)

Removes the last element that equals e1, returning its deleted position or -1 if the element was not found.

removeLastback to summary
public KType removeLast()

Removes and returns the last element of this container. This container must not be empty.

removeRangeback to summary
public void removeRange(int fromIndex, int toIndex)

Removes from this container all of the elements with indexes between fromIndex, inclusive, and toIndex, exclusive.

reverseback to summary
public ObjectIndexedContainer<KType> reverse()

Reverses the elements in this container and returns this container.

setback to summary
public KType set(int index, KType e1)

Replaces the element at the specified position in this list with the specified element.

Returns:KType

Returns the previous value in the list.

sortback to summary
public ObjectIndexedContainer<KType> sort()

Sorts the elements in this container and returns this container.

streamback to summary
public Stream<KType> stream()

Returns this container elements as a stream.