public class SparseArray extends AssocArray implements Externalizable
Modifier and Type | Class and Description |
---|---|
class |
SparseArray.SAPairEnumeration |
AssocArray.Pair, AssocArray.PairEnumeration
keys, values
Constructor and Description |
---|
SparseArray()
Constructs an instance of
SparseArray . |
Modifier and Type | Method and Description |
---|---|
void |
add(FList newElement)
Adds a new element to the end of array.
|
void |
add(int index,
FList newElement)
Adds a new element to the array.
|
void |
dump()
Dumps the SparseArray.
|
FList |
elementAt(int index)
Returns the element, if any, associated with an index.
|
FList |
elementAt(Integer index)
Returns the element, if any, associated with an index.
|
FList |
getAnyElement()
Returns an element (usually called when it is known that
there is only one).
|
Enumeration<Integer> |
getKeyEnumerator()
Returns an enumeration of the index values in the array.
|
List<Integer> |
getKeys()
Returns a read-only list of the index values in the sparsearray
|
AssocArray.PairEnumeration |
getPairs() |
int |
getSize()
Returns the number of element pairs in the array.
|
Enumeration<FList> |
getValueEnumerator()
Returns an enumeration of the values in the array.
|
List<FList> |
getValues()
Returns a read-only list of the values in the sparsearray
|
void |
readExternal(ObjectInput in) |
void |
remove(int index)
Remove an element from the array.
|
void |
writeExternal(ObjectOutput out) |
clear, containsKey, elements, get, isEmpty, keys, put, remove, size
public SparseArray()
SparseArray
.
The array is initially empty.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public int getSize()
public FList elementAt(int index)
index
- Where to find the element.Element.ELEMID_ANY
,
Element.ELEMID_ASSIGN
,
Element.ELEMID_MAX
public FList elementAt(Integer index)
index
- Where to find the element.Element.ELEMID_ANY
,
Element.ELEMID_ASSIGN
,
Element.ELEMID_MAX
public FList getAnyElement()
public void add(int index, FList newElement)
index
- Where to add the new element.newElement
- The new element to add.Element.ELEMID_ANY
,
Element.ELEMID_ASSIGN
,
Element.ELEMID_MAX
public void add(FList newElement)
newElement
- The new element to add.Element.ELEMID_ANY
,
Element.ELEMID_ASSIGN
,
Element.ELEMID_MAX
public void remove(int index)
index
- Where to remove the element.public Enumeration<FList> getValueEnumerator()
public Enumeration<Integer> getKeyEnumerator()
public List<FList> getValues()
public List<Integer> getKeys()
public AssocArray.PairEnumeration getPairs()
getPairs
in class AssocArray
public void dump()
Copyright © 2003, 2023, Oracle and/or its affiliates.