Code example for SortedMap

Methods: subMap

  private class SortedMapBasedElementSet extends MapBasedElementSet 
      implements SortedSet<E> {
    SortedMapBasedElementSet(SortedMap<E, AtomicInteger> 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));
Connect your IDE to all the code out there  Get Codota for Java