Code example for SortedMap

Methods: entrySet

0
    try { 
      // any CCE will be caught 
      @SuppressWarnings("unchecked") 
      SortedMap<Object, V> self = (SortedMap<Object, V>) this;
      Iterator<Entry<Object, V>> entryIterator =
          self.tailMap(key).entrySet().iterator();
      if (entryIterator.hasNext()) {
        Entry<Object, V> ceilingEntry = entryIterator.next();
        if (unsafeCompare(ceilingEntry.getKey(), key) == 0) {
          V value = ceilingEntry.getValue();
          entryIterator.remove();
          return value;
        } 
      } 
    } catch (ClassCastException e) {
      return null; 
    } catch (NullPointerException e) {
      return null; 
    } 
    return null;