com.carrotsearch.hppc
Interface ShortIndexedContainer

All Superinterfaces:
java.lang.Iterable<ShortCursor>, java.util.RandomAccess, ShortCollection, ShortContainer
All Known Implementing Classes:
ShortArrayList, ShortStack

@Generated(date="2011-07-12T16:58:51+0200",
           value="HPPC generated from: ShortIndexedContainer.java")
public interface ShortIndexedContainer
extends ShortCollection, java.util.RandomAccess

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

removeFirstOccurrence

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


removeLastOccurrence

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


indexOf

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.


lastIndexOf

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.


add

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


insert

void insert(int index,
            short 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

short set(int index,
          short e1)
Replaces the element at the specified position in this list with the specified element.

Returns:
Returns the previous value in the list.

get

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

remove

short remove(int index)
Removes the element at the specified position in this list and returns it.

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.


removeRange

void removeRange(int fromIndex,
                 int toIndex)
Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.


equals

boolean equals(java.lang.Object obj)
Compares the specified object with this container for equality. Returns true if and only if the specified object is also a 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.

Overrides:
equals in class java.lang.Object

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
A hash code of elements stored in the container. The hash code is defined identically to List.hashCode() (should be implemented with the same algorithm).


Copyright © 2011 Carrot Search s.c.. All Rights Reserved.