net.sf.beanlib.util.concurrent
Class ConcurrentSkipListMap.KeySet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by net.sf.beanlib.util.concurrent.ConcurrentSkipListMap.KeySet<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>, SortedSet<E>, NavigableSet<E>
Enclosing class:
ConcurrentSkipListMap<K,V>

static final class ConcurrentSkipListMap.KeySet<E>
extends AbstractSet<E>
implements NavigableSet<E>


Field Summary
private  ConcurrentNavigableMap<E,Object> m
           
 
Constructor Summary
ConcurrentSkipListMap.KeySet(ConcurrentNavigableMap<E,Object> map)
           
 
Method Summary
 E ceiling(E e)
          Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
 void clear()
           
 Comparator<? super E> comparator()
           
 boolean contains(Object o)
           
 Iterator<E> descendingIterator()
          Returns an iterator over the elements in this set, in descending order.
 NavigableSet<E> descendingSet()
          Returns a reverse order view of the elements contained in this set.
 boolean equals(Object o)
           
 E first()
           
 E floor(E e)
          Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.
 NavigableSet<E> headSet(E toElement)
          
 NavigableSet<E> headSet(E toElement, boolean inclusive)
          Returns a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement.
 E higher(E e)
          Returns the least element in this set strictly greater than the given element, or null if there is no such element.
 boolean isEmpty()
           
 Iterator<E> iterator()
          Returns an iterator over the elements in this set, in ascending order.
 E last()
           
 E lower(E e)
          Returns the greatest element in this set strictly less than the given element, or null if there is no such element.
 E pollFirst()
          Retrieves and removes the first (lowest) element, or returns null if this set is empty.
 E pollLast()
          Retrieves and removes the last (highest) element, or returns null if this set is empty.
 boolean remove(Object o)
           
 int size()
           
 NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
          Returns a view of the portion of this set whose elements range from fromElement to toElement.
 NavigableSet<E> subSet(E fromElement, E toElement)
          
 NavigableSet<E> tailSet(E fromElement)
          
 NavigableSet<E> tailSet(E fromElement, boolean inclusive)
          Returns a view of the portion of this set whose elements are greater than (or equal to, if inclusive is true) fromElement.
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.util.AbstractSet
hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
add, addAll, containsAll, retainAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, containsAll, hashCode, removeAll, retainAll
 

Field Detail

m

private final ConcurrentNavigableMap<E,Object> m
Constructor Detail

ConcurrentSkipListMap.KeySet

ConcurrentSkipListMap.KeySet(ConcurrentNavigableMap<E,Object> map)
Method Detail

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>
Specified by:
size in class AbstractCollection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>
Overrides:
isEmpty in class AbstractCollection<E>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>
Overrides:
contains in class AbstractCollection<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class AbstractCollection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Overrides:
clear in class AbstractCollection<E>

lower

public E lower(E e)
Description copied from interface: NavigableSet
Returns the greatest element in this set strictly less than the given element, or null if there is no such element.

Specified by:
lower in interface NavigableSet<E>
Parameters:
e - the value to match
Returns:
the greatest element less than e, or null if there is no such element

floor

public E floor(E e)
Description copied from interface: NavigableSet
Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.

Specified by:
floor in interface NavigableSet<E>
Parameters:
e - the value to match
Returns:
the greatest element less than or equal to e, or null if there is no such element

ceiling

public E ceiling(E e)
Description copied from interface: NavigableSet
Returns the least element in this set greater than or equal to the given element, or null if there is no such element.

Specified by:
ceiling in interface NavigableSet<E>
Parameters:
e - the value to match
Returns:
the least element greater than or equal to e, or null if there is no such element

higher

public E higher(E e)
Description copied from interface: NavigableSet
Returns the least element in this set strictly greater than the given element, or null if there is no such element.

Specified by:
higher in interface NavigableSet<E>
Parameters:
e - the value to match
Returns:
the least element greater than e, or null if there is no such element

comparator

public Comparator<? super E> comparator()
Specified by:
comparator in interface SortedSet<E>

first

public E first()
Specified by:
first in interface SortedSet<E>

last

public E last()
Specified by:
last in interface SortedSet<E>

pollFirst

public E pollFirst()
Description copied from interface: NavigableSet
Retrieves and removes the first (lowest) element, or returns null if this set is empty.

Specified by:
pollFirst in interface NavigableSet<E>
Returns:
the first element, or null if this set is empty

pollLast

public E pollLast()
Description copied from interface: NavigableSet
Retrieves and removes the last (highest) element, or returns null if this set is empty.

Specified by:
pollLast in interface NavigableSet<E>
Returns:
the last element, or null if this set is empty

iterator

public Iterator<E> iterator()
Description copied from interface: NavigableSet
Returns an iterator over the elements in this set, in ascending order.

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Specified by:
iterator in interface NavigableSet<E>
Specified by:
iterator in class AbstractCollection<E>
Returns:
an iterator over the elements in this set, in ascending order

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<E>
Specified by:
equals in interface Set<E>
Overrides:
equals in class AbstractSet<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>
Overrides:
toArray in class AbstractCollection<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>
Overrides:
toArray in class AbstractCollection<E>

descendingIterator

public Iterator<E> descendingIterator()
Description copied from interface: NavigableSet
Returns an iterator over the elements in this set, in descending order. Equivalent in effect to descendingSet().iterator().

Specified by:
descendingIterator in interface NavigableSet<E>
Returns:
an iterator over the elements in this set, in descending order

subSet

public NavigableSet<E> subSet(E fromElement,
                              boolean fromInclusive,
                              E toElement,
                              boolean toInclusive)
Description copied from interface: NavigableSet
Returns a view of the portion of this set whose elements range from fromElement to toElement. If fromElement and toElement are equal, the returned set is empty unless fromExclusive and toExclusive are both true. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Specified by:
subSet in interface NavigableSet<E>
Parameters:
fromElement - low endpoint of the returned set
fromInclusive - true if the low endpoint is to be included in the returned view
toElement - high endpoint of the returned set
toInclusive - true if the high endpoint is to be included in the returned view
Returns:
a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive

headSet

public NavigableSet<E> headSet(E toElement,
                               boolean inclusive)
Description copied from interface: NavigableSet
Returns a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Specified by:
headSet in interface NavigableSet<E>
Parameters:
toElement - high endpoint of the returned set
inclusive - true if the high endpoint is to be included in the returned view
Returns:
a view of the portion of this set whose elements are less than (or equal to, if inclusive is true) toElement

tailSet

public NavigableSet<E> tailSet(E fromElement,
                               boolean inclusive)
Description copied from interface: NavigableSet
Returns a view of the portion of this set whose elements are greater than (or equal to, if inclusive is true) fromElement. The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports.

The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.

Specified by:
tailSet in interface NavigableSet<E>
Parameters:
fromElement - low endpoint of the returned set
inclusive - true if the low endpoint is to be included in the returned view
Returns:
a view of the portion of this set whose elements are greater than or equal to fromElement

subSet

public NavigableSet<E> subSet(E fromElement,
                              E toElement)
Description copied from interface: NavigableSet

Equivalent to subSet(fromElement, true, toElement, false).

Specified by:
subSet in interface SortedSet<E>
Specified by:
subSet in interface NavigableSet<E>

headSet

public NavigableSet<E> headSet(E toElement)
Description copied from interface: NavigableSet

Equivalent to headSet(toElement, false).

Specified by:
headSet in interface SortedSet<E>
Specified by:
headSet in interface NavigableSet<E>

tailSet

public NavigableSet<E> tailSet(E fromElement)
Description copied from interface: NavigableSet

Equivalent to tailSet(fromElement, true).

Specified by:
tailSet in interface SortedSet<E>
Specified by:
tailSet in interface NavigableSet<E>

descendingSet

public NavigableSet<E> descendingSet()
Description copied from interface: NavigableSet
Returns a reverse order view of the elements contained in this set. The descending set is backed by this set, so changes to the set are reflected in the descending set, and vice-versa. If either set is modified while an iteration over either set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined.

The returned set has an ordering equivalent to Collections.reverseOrder(comparator()). The expression s.descendingSet().descendingSet() returns a view of s essentially equivalent to s.

Specified by:
descendingSet in interface NavigableSet<E>
Returns:
a reverse order view of this set