CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Class RestrictedCollections.RestrictedSortedSet

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.RestrictedCollections.RestrictedCollection
          extended by com.tangosol.util.RestrictedCollections.RestrictedSet
              extended by com.tangosol.util.RestrictedCollections.RestrictedSortedSet
All Implemented Interfaces:
Serializable, Iterable, Collection, Set, SortedSet
Enclosing class:
RestrictedCollections

public static class RestrictedCollections.RestrictedSortedSet
extends RestrictedCollections.RestrictedSet
implements SortedSet, Serializable

A restricted Set that requires its contents to be of a specified class.


Field Summary
 
Fields inherited from class com.tangosol.util.RestrictedCollections.RestrictedCollection
m_clz, m_col
 
Constructor Summary
RestrictedCollections.RestrictedSortedSet(SortedSet set, Class clz)
          Constructor.
 
Method Summary
 Comparator comparator()
          Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering.
 Object first()
          Returns the first (lowest) element currently in this sorted set.
 SortedSet headSet(Object toElement)
          Returns a view of the portion of this sorted set whose elements are strictly less than toElement.
 Object last()
          Returns the last (highest) element currently in this sorted set.
 SortedSet subSet(Object fromElement, Object toElement)
          Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive.
 SortedSet tailSet(Object fromElement)
          Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement.
 
Methods inherited from class com.tangosol.util.RestrictedCollections.RestrictedCollection
add, addAll, checkObject, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

RestrictedCollections.RestrictedSortedSet

public RestrictedCollections.RestrictedSortedSet(SortedSet set,
                                                 Class clz)
Constructor.

Parameters:
set - the underlying SortedSet
clz - the class of objects that may be stored in the SortedSet
Method Detail

comparator

public Comparator comparator()
Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering.

Specified by:
comparator in interface SortedSet
Returns:
the comparator associated with this sorted set, or null if it uses its elements' natural ordering

subSet

public SortedSet subSet(Object fromElement,
                        Object toElement)
Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive. (If fromElement and toElement are equal, the returned sorted set is empty.) The returned sorted set is backed by this sorted set, so changes in the returned sorted set are reflected in this sorted set, and vice-versa. The returned sorted set supports all optional set operations that this sorted set supports.

Obeys the general contract of SortedSet.subSet.

Specified by:
subSet in interface SortedSet
Parameters:
fromElement - low endpoint (inclusive) of the subSet
toElement - high endpoint (exclusive) of the subSet
Returns:
a view of the specified range within this sorted set

headSet

public SortedSet headSet(Object toElement)
Returns a view of the portion of this sorted set whose elements are strictly less than toElement. The returned sorted set is backed by this sorted set, so changes in the returned sorted set are reflected in this sorted set, and vice-versa. The returned sorted set supports all optional set operations.

Obeys the general contract of SortedSet.headSet.

Specified by:
headSet in interface SortedSet
Parameters:
toElement - high endpoint (exclusive) of the headSet
Returns:
a view of the specified initial range of this sorted set

tailSet

public SortedSet tailSet(Object fromElement)
Returns a view of the portion of this sorted set whose elements are greater than or equal to fromElement. The returned sorted set is backed by this sorted set, so changes in the returned sorted set are reflected in this sorted set, and vice-versa. The returned sorted set supports all optional set operations.

Obeys the general contract of SortedSet.tailSet.

Specified by:
tailSet in interface SortedSet
Parameters:
fromElement - low endpoint (inclusive) of the tailSet
Returns:
a view of the specified final range of this sorted set

first

public Object first()
Returns the first (lowest) element currently in this sorted set.

Specified by:
first in interface SortedSet
Returns:
the first (lowest) element currently in this sorted set
Throws:
NoSuchElementException - sorted set is empty

last

public Object last()
Returns the last (highest) element currently in this sorted set.

Specified by:
last in interface SortedSet
Returns:
the last (highest) element currently in this sorted set
Throws:
NoSuchElementException - sorted set is empty

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation