code: public SortedMap headMap(Object endKey) {
          // Check for errors
          if (comparator == null)
              ((Comparable) endKey).compareTo(endKey);
          else
              comparator.compare(endKey, endKey);
          return makeSubMap(null, endKey);
      }
docs: Answers a SortedMap of the specified portion of this TreeMap which
  contains keys less than the end key. The returned SortedMap is backed by
  this TreeMap so changes to one are reflected by the other.
  
  @param endKey the end key
  
  @return a submap where the keys are less than <code>endKey</code>
  
  @exception ClassCastException
  when the end key cannot be compared with the keys in this
  TreeMap
  @exception NullPointerException
  when the end key is null and the comparator cannot handle
  null