Code example for SortedMap

Methods: tailMap

0
 
  private class SortedMapBasedElementSet extends MapBasedElementSet 
      implements SortedSet<E> {
 
    SortedMapBasedElementSet(SortedMap<E, AtomicInteger> map) {
      super(map);
    } 
 
    SortedMap<E, AtomicInteger> sortedMap() {
      return (SortedMap<E, AtomicInteger>) getMap();
    } 
 
    public Comparator<? super E> comparator() {
      return sortedMap().comparator();
    } 
 
    public E first() { 
      return sortedMap().firstKey();
    } 
 
    public E last() { 
      return sortedMap().lastKey();
    } 
 
    public SortedSet<E> headSet(E toElement) {
      return new SortedMapBasedElementSet(sortedMap().headMap(toElement));
    } 
 
    public SortedSet<E> subSet(E fromElement, E toElement) {
      return new SortedMapBasedElementSet( 
          sortedMap().subMap(fromElement, toElement));
    } 
 
    public SortedSet<E> tailSet(E fromElement) {
      return new SortedMapBasedElementSet(sortedMap().tailMap(fromElement));
    } 
 
    @Override public boolean remove(Object element) {
      try { 
        return super.remove(element);