@Generated(date="2015-06-17T12:23:38+0000", value="HPPC generated from: ObjectIndexedContainer.java") public interface ObjectIndexedContainer<KType> extends ObjectCollection<KType>, java.util.RandomAccess
index
. Indexes are zero-based.Modifier and Type | Method and Description |
---|---|
void |
add(KType e1)
Adds an element to the end of this container (the last index is incremented by one).
|
boolean |
equals(java.lang.Object obj)
Compares the specified object with this container for equality.
|
KType |
get(int index) |
int |
hashCode() |
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.
|
void |
insert(int index,
KType e1)
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.
|
KType |
remove(int index)
Removes the element at the specified position in this list and returns it.
|
int |
removeFirstOccurrence(KType e1)
Removes the first element that equals
e1 , returning its
deleted position or -1 if the element was not found. |
int |
removeLastOccurrence(KType e1)
Removes the last element that equals
e1 , returning its
deleted position or -1 if the element was not found. |
void |
removeRange(int fromIndex,
int toIndex)
Removes from this list all of the elements whose index is between
fromIndex , inclusive, and toIndex , exclusive. |
KType |
set(int index,
KType e1)
Replaces the element at the specified position in this list
with the specified element.
|
clear, removeAll, removeAll, removeAllOccurrences, retainAll, retainAll
int removeFirstOccurrence(KType e1)
e1
, returning its
deleted position or -1
if the element was not found.int removeLastOccurrence(KType e1)
e1
, returning its
deleted position or -1
if the element was not found.int indexOf(KType e1)
int lastIndexOf(KType e1)
void add(KType e1)
void insert(int index, KType e1)
index
- The index at which the element should be inserted, shifting
any existing and subsequent elements to the right.KType set(int index, KType e1)
KType get(int index)
index
from the list.KType remove(int index)
Careful. Do not confuse this method with the overridden signature in
Java Collections (List.remove(Object)
). Use: ObjectCollection.removeAll(com.carrotsearch.hppc.ObjectLookupContainer<? extends KType>)
,
removeFirstOccurrence(KType)
or removeLastOccurrence(KType)
depending
on the actual need.
void removeRange(int fromIndex, int toIndex)
fromIndex
, inclusive, and toIndex
, exclusive.boolean equals(java.lang.Object obj)
ObjectIndexedContainer
, both have the same size, and all corresponding
pairs of elements at the same index are equal. In other words, two indexed
containers are defined to be equal if they contain the same elements in the same
order.
Note that, unlike in List
, containers may be of different types and still
return true
from equals(java.lang.Object)
. This may be dangerous if you use
different hash functions in two containers, but don't override the default
implementation of equals(java.lang.Object)
. It is the programmer's responsibility to
enforcing these contracts properly.
equals
in class java.lang.Object
int hashCode()
hashCode
in class java.lang.Object
List.hashCode()
(should be implemented
with the same algorithm).Copyright © 2015 Carrot Search s.c.. All rights reserved.