Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.util
Class WrapperCollections.AbstractWrapperSortedSet

java.lang.Object
  extended by com.tangosol.util.WrapperCollections.AbstractWrapperCollection
      extended by com.tangosol.util.WrapperCollections.AbstractWrapperSet
          extended by com.tangosol.util.WrapperCollections.AbstractWrapperSortedSet

All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set, java.util.SortedSet
Direct Known Subclasses:
ImmutableArrayList.SortedSetView
Enclosing class:
WrapperCollections

public abstract static class WrapperCollections.AbstractWrapperSortedSet
extends WrapperCollections.AbstractWrapperSet
implements java.util.SortedSet

SortedSet implementation which delegates all calls to another SortedSet.


Field Summary
protected  java.util.SortedSet m_setDelegate
          The Set to which this wrapper delegates.

 

Fields inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperCollection
m_colDelegate

 

Constructor Summary
protected WrapperCollections.AbstractWrapperSortedSet(java.util.SortedSet set)
          Create an AbstractWrapperSortedSet which delegates to the specified SortedSet.

 

Method Summary
 java.util.Comparator comparator()
          Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering.
 java.lang.Object first()
          Returns the first (lowest) element currently in this sorted set.
protected  java.util.SortedSet getDelegate()
          Return the SortedSet to which all operations should be delegated to.
 java.util.SortedSet headSet(java.lang.Object oTo)
          Returns a view of the portion of this sorted set whose elements are strictly less than toElement.
 java.lang.Object last()
          Returns the last (highest) element currently in this sorted set.
 java.util.SortedSet subSet(java.lang.Object oFrom, java.lang.Object oTo)
          Returns a view of the portion of this sorted set whose elements range from fromElement, inclusive, to toElement, exclusive.
 java.util.SortedSet tailSet(java.lang.Object oFrom)
          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.WrapperCollections.AbstractWrapperCollection
add, addAll, 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

 

Field Detail

m_setDelegate

protected final java.util.SortedSet m_setDelegate
The Set to which this wrapper delegates.

Constructor Detail

WrapperCollections.AbstractWrapperSortedSet

protected WrapperCollections.AbstractWrapperSortedSet(java.util.SortedSet set)
Create an AbstractWrapperSortedSet which delegates to the specified SortedSet.
Parameters:
set - the SortedSet to delegate all calls to

Method Detail

getDelegate

protected java.util.SortedSet getDelegate()
Return the SortedSet to which all operations should be delegated to.
Overrides:
getDelegate in class WrapperCollections.AbstractWrapperSet
Returns:
the wrapped Set

comparator

public java.util.Comparator comparator()
Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering.
Specified by:
comparator in interface java.util.SortedSet
Returns:
the comparator associated with this sorted set, or null if it uses its elements' natural ordering.

subSet

public java.util.SortedSet subSet(java.lang.Object oFrom,
                                  java.lang.Object oTo)
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.

The sorted set returned by this method will throw an IllegalArgumentException if the user attempts to insert a element outside the specified range.

Note: this method always returns a half-open range (which includes its low endpoint but not its high endpoint). If you need a closed range (which includes both endpoints), and the element type allows for calculation of the successor a given value, merely request the subrange from lowEndpoint to successor(highEndpoint). For example, suppose that s is a sorted set of strings. The following idiom obtains a view containing all of the strings in s from low to high, inclusive:

 SortedSet sub = s.subSet(low, high+"\0");
 
A similar technique can be used to generate an open range (which contains neither endpoint). The following idiom obtains a view containing all of the Strings in s from low to high, exclusive:
 SortedSet sub = s.subSet(low+"\0", high);
 
Specified by:
subSet in interface java.util.SortedSet
Parameters:
oFrom - low endpoint (inclusive) of the subSet.
oTo - high endpoint (exclusive) of the subSet.
Returns:
a view of the specified range within this sorted set.

headSet

public java.util.SortedSet headSet(java.lang.Object oTo)
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.

The sorted set returned by this method will throw an IllegalArgumentException if the user attempts to insert a element outside the specified range.

Note: this method always returns a view that does not contain its (high) endpoint. If you need a view that does contain this endpoint, and the element type allows for calculation of the successor a given value, merely request a headSet bounded by successor(highEndpoint). For example, suppose that s is a sorted set of strings. The following idiom obtains a view containing all of the strings in s that are less than or equal to high:

    SortedSet head = s.headSet(high+"\0");
Specified by:
headSet in interface java.util.SortedSet
Parameters:
oTo - high endpoint (exclusive) of the headSet.
Returns:
a view of the specified initial range of this sorted set.

tailSet

public java.util.SortedSet tailSet(java.lang.Object oFrom)
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.

The sorted set returned by this method will throw an IllegalArgumentException if the user attempts to insert a element outside the specified range.

Note: this method always returns a view that contains its (low) endpoint. If you need a view that does not contain this endpoint, and the element type allows for calculation of the successor a given value, merely request a tailSet bounded by successor(lowEndpoint). For example, suppose that s is a sorted set of strings. The following idiom obtains a view containing all of the strings in s that are strictly greater than low:

    SortedSet tail = s.tailSet(low+"\0");
Specified by:
tailSet in interface java.util.SortedSet
Parameters:
oFrom - low endpoint (inclusive) of the tailSet.
Returns:
a view of the specified final range of this sorted set.

first

public java.lang.Object first()
Returns the first (lowest) element currently in this sorted set.
Specified by:
first in interface java.util.SortedSet
Returns:
the first (lowest) element currently in this sorted set.

last

public java.lang.Object last()
Returns the last (highest) element currently in this sorted set.
Specified by:
last in interface java.util.SortedSet
Returns:
the last (highest) element currently in this sorted set.

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


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