|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Generated(date="2011-07-12T16:58:51+0200", value="HPPC generated from: ShortIndexedContainer.java") public interface ShortIndexedContainer
An indexed container provides random access to elements based on an
index
. Indexes are zero-based.
Method Summary | |
---|---|
void |
add(short 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. |
short |
get(int index)
|
int |
hashCode()
|
int |
indexOf(short 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,
short e1)
Inserts the specified element at the specified position in this list. |
int |
lastIndexOf(short 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. |
short |
remove(int index)
Removes the element at the specified position in this list and returns it. |
int |
removeFirstOccurrence(short e1)
Removes the first element that equals e1 , returning its
deleted position or -1 if the element was not found. |
int |
removeLastOccurrence(short 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. |
short |
set(int index,
short e1)
Replaces the element at the specified position in this list with the specified element. |
Methods inherited from interface com.carrotsearch.hppc.ShortCollection |
---|
clear, removeAll, removeAll, removeAllOccurrences, retainAll, retainAll |
Methods inherited from interface com.carrotsearch.hppc.ShortContainer |
---|
contains, forEach, forEach, isEmpty, iterator, size, toArray |
Method Detail |
---|
int removeFirstOccurrence(short e1)
e1
, returning its
deleted position or -1
if the element was not found.
int removeLastOccurrence(short e1)
e1
, returning its
deleted position or -1
if the element was not found.
int indexOf(short e1)
int lastIndexOf(short e1)
void add(short e1)
void insert(int index, short e1)
index
- The index at which the element should be inserted, shifting
any existing and subsequent elements to the right.short set(int index, short e1)
short get(int index)
index
from the list.short remove(int index)
Careful. Do not confuse this method with the overridden signature in
Java Collections (List.remove(Object)
). Use: ShortCollection.removeAll(com.carrotsearch.hppc.ShortLookupContainer)
,
removeFirstOccurrence(short)
or removeLastOccurrence(short)
depending
on the actual need.
void removeRange(int fromIndex, int toIndex)
fromIndex
, inclusive, and toIndex
, exclusive.
boolean equals(java.lang.Object obj)
ShortIndexedContainer
, 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).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |