Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Interface LongArray

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Implementing Classes:
AbstractLongArray, AbstractSparseArray, CopyOnWriteLongArray, PrimitiveSparseArray, SimpleLongArray, SparseArray

public interface LongArray
extends java.lang.Cloneable, java.io.Serializable

An interface, similar in its methods to List, and similar in its purpose to a Java array, designed for sparse storage and indexed by long values.

Unlike the List interface, the LongArray interface assumes that every index can be accessed and has storage available.

Version:
1.00 2002.04.24 based on WindowedArray component and SparseArray prototype
Author:
cp

Nested Class Summary
static interface LongArray.Iterator
          An Iterator that adds a "current element" concept, similar to the Map.Entry interface.

 

Field Summary
static long NOT_FOUND
          This index is used to indicate that an element was not found.

 

Method Summary
 long add(java.lang.Object oValue)
          Add the passed element value to the LongArray and return the index at which the element value was stored.
 void clear()
          Remove all nodes from the LongArray.
 java.lang.Object clone()
          Make a clone of the LongArray.
 boolean contains(java.lang.Object oValue)
          Determine if the LongArray contains the specified element.
 boolean equals(java.lang.Object o)
          Test for LongArray equality.
 boolean exists(long lIndex)
          Determine if the specified index is in use.
 java.lang.Object get(long lIndex)
          Return the value stored at the specified index.
 long getFirstIndex()
          Determine the first index that exists in the LongArray.
 long getLastIndex()
          Determine the last index that exists in the LongArray.
 int getSize()
          Determine the size of the LongArray.
 long indexOf(java.lang.Object oValue)
          Return the index in this LongArray of the first occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.
 long indexOf(java.lang.Object oValue, long lIndex)
          Return the index in this LongArray of the first occurrence of the specified element such that (index >= lIndex), or NOT_FOUND if this LongArray does not contain the specified element.
 boolean isEmpty()
          Test for empty LongArray.
 LongArray.Iterator iterator()
          Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices.
 LongArray.Iterator iterator(long lIndex)
          Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices, starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is greater than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
 long lastIndexOf(java.lang.Object oValue)
          Return the index in this LongArray of the last occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.
 long lastIndexOf(java.lang.Object oValue, long lIndex)
          Return the index in this LongArray of the last occurrence of the specified element such that (index <= lIndex), or NOT_FOUND if this LongArray does not contain the specified element.
 java.lang.Object remove(long lIndex)
          Remove the specified index from the LongArray, returning its associated value.
 LongArray.Iterator reverseIterator()
          Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices).
 LongArray.Iterator reverseIterator(long lIndex)
          Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices), starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is less than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
 java.lang.Object set(long lIndex, java.lang.Object oValue)
          Add the passed item to the LongArray at the specified index.
 java.lang.String toString()
          Provide a string representation of the LongArray.

 

Field Detail

NOT_FOUND

static final long NOT_FOUND
This index is used to indicate that an element was not found.
See Also:
Constant Field Values

Method Detail

get

java.lang.Object get(long lIndex)
Return the value stored at the specified index.
Parameters:
lIndex - a long index value
Returns:
the object stored at the specified index, or null

set

java.lang.Object set(long lIndex,
                     java.lang.Object oValue)
Add the passed item to the LongArray at the specified index.

If the index is already used, the passed value will replace the current value stored with the key, and the replaced value will be returned.

It is expected that LongArray implementations will "grow" as necessary to support the specified index.

Parameters:
lIndex - a long index value
oValue - the object to store at the specified index
Returns:
the object that was stored at the specified index, or null

add

long add(java.lang.Object oValue)
Add the passed element value to the LongArray and return the index at which the element value was stored.
Parameters:
oValue - the object to add to the LongArray
Returns:
the long index value at which the element value was stored

exists

boolean exists(long lIndex)
Determine if the specified index is in use.
Parameters:
lIndex - a long index value
Returns:
true if a value (including null) is stored at the specified index, otherwise false

remove

java.lang.Object remove(long lIndex)
Remove the specified index from the LongArray, returning its associated value.
Parameters:
lIndex - the index into the LongArray
Returns:
the associated value (which can be null) or null if the specified index is not in the LongArray

contains

boolean contains(java.lang.Object oValue)
Determine if the LongArray contains the specified element.

More formally, returns true if and only if this LongArray contains at least one element e such that (o==null ? e==null : o.equals(e)).

Parameters:
oValue - element whose presence in this list is to be tested
Returns:
true if this list contains the specified element

clear

void clear()
Remove all nodes from the LongArray.

isEmpty

boolean isEmpty()
Test for empty LongArray.
Returns:
true if LongArray has no nodes

getSize

int getSize()
Determine the size of the LongArray.
Returns:
the number of nodes in the LongArray

iterator

LongArray.Iterator iterator()
Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices.
Returns:
an instance of LongArray.Iterator

iterator

LongArray.Iterator iterator(long lIndex)
Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices, starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is greater than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
Parameters:
lIndex - the LongArray index to iterate from
Returns:
an instance of LongArray.Iterator

reverseIterator

LongArray.Iterator reverseIterator()
Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices).
Returns:
an instance of LongArray.Iterator

reverseIterator

LongArray.Iterator reverseIterator(long lIndex)
Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices), starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is less than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
Parameters:
lIndex - the LongArray index to iterate from
Returns:
an instance of LongArray.Iterator

getFirstIndex

long getFirstIndex()
Determine the first index that exists in the LongArray.
Returns:
the lowest long value that exists in this LongArray, or NOT_FOUND if the LongArray is empty

getLastIndex

long getLastIndex()
Determine the last index that exists in the LongArray.
Returns:
the highest long value that exists in this LongArray, or NOT_FOUND if the LongArray is empty

indexOf

long indexOf(java.lang.Object oValue)
Return the index in this LongArray of the first occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.

indexOf

long indexOf(java.lang.Object oValue,
             long lIndex)
Return the index in this LongArray of the first occurrence of the specified element such that (index >= lIndex), or NOT_FOUND if this LongArray does not contain the specified element.

lastIndexOf

long lastIndexOf(java.lang.Object oValue)
Return the index in this LongArray of the last occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.

lastIndexOf

long lastIndexOf(java.lang.Object oValue,
                 long lIndex)
Return the index in this LongArray of the last occurrence of the specified element such that (index <= lIndex), or NOT_FOUND if this LongArray does not contain the specified element.

toString

java.lang.String toString()
Provide a string representation of the LongArray.
Returns:
a human-readable String value describing the LongArray instance

equals

boolean equals(java.lang.Object o)
Test for LongArray equality.
Parameters:
o - an Object to compare to this LongArray for equality
Returns:
true if the passed Object is a LongArray containing the same indexes and whose elements at those indexes are equal

clone

java.lang.Object clone()
Make a clone of the LongArray. The element values are not deep-cloned.
Returns:
a clone of this LongArray object

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.