org.openmdx.base.collection
Class TreeSparseArray

java.lang.Object
  extended by org.openmdx.base.collection.AbstractSparseArray
      extended by org.openmdx.base.collection.TreeSparseArray
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, SparseArray

public class TreeSparseArray
extends AbstractSparseArray
implements Cloneable, Serializable

See Also:
Serialized Form

Constructor Summary
TreeSparseArray()
          Constructs an empty sparse array.
TreeSparseArray(Collection collection)
          Constructs an empty list with the specified initial capacity.
TreeSparseArray(SparseArray collection)
          Constructs a new sparse array containing the same entries as the given sparse array.
 
Method Summary
 Object clone()
          Returns a shallow copy of this TreeSparseArray instance.
 SortedMap populationMap()
          Returns a map view of this sparse array's populated elements.
 
Methods inherited from class org.openmdx.base.collection.AbstractSparseArray
add, addAll, asList, clear, contains, containsAll, end, get, indexOf, isEmpty, iterator, lowerBound, populationIterator, populationIterator, remove, remove, removeAll, retainAll, set, setAll, size, start, subArray, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

TreeSparseArray

public TreeSparseArray()
Constructs an empty sparse array.


TreeSparseArray

public TreeSparseArray(SparseArray collection)
Constructs a new sparse array containing the same entries as the given sparse array.

Parameters:
collection - sparse array whose entries are to be placed into this sparse array

TreeSparseArray

public TreeSparseArray(Collection collection)
Constructs an empty list with the specified initial capacity.

Parameters:
collection - a collection whose entries are to be placed into this sparse array
Method Detail

populationMap

public SortedMap populationMap()
Returns a map view of this sparse array's populated elements. The map's iterator will return the entries in ascending order. The map is backed by the sparse array, so changes to the sparse array are reflected in the map, and vice-versa. If the sparse array is modified while an iteration over the map is in progress, the results of the iteration are undefined. The map supports element removal, which removes the corresponding entry from the sparse array, via the Iterator.remove, Map.remove, removeAll retainAll, and clear operations. It does not support the add or addAll operations.

Specified by:
populationMap in interface SparseArray
Specified by:
populationMap in class AbstractSparseArray
Returns:
a map view of this sparse array's populated elements

clone

public Object clone()
Returns a shallow copy of this TreeSparseArray instance. (The keys and values themselves are not cloned.)

Overrides:
clone in class Object
Returns:
a shallow copy of this Map.


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.