public SortedMap subMap ( Object startKey , Object endKey ) { if ( comparator == null ) { if ( ( ( Comparable ) startKey ) . compareTo ( endKey ) <= 0 ) return makeSubMap ( startKey , endKey ) ; } else { if ( comparator . compare ( startKey , endKey ) <= 0 ) return makeSubMap ( startKey , endKey ) ; } throw new IllegalArgumentException ( ) ; }
Answers a SortedMap of the specified portion of this TreeMap which contains keys greater or equal to the start key but less than the end key . The returned SortedMap is backed by this TreeMap so changes to one are reflected by the other .