Code example for TreeMap

Methods: containsKey, tailMap

0
     *	Returns the least key greater than or equal to the given key,  
     *	or null if there is no such key. 
     */ 
    final Integer ceilingKey(Integer time) {
    	 
    	if(events.containsKey(time)) {
    		return time;
    	} 
    	 
    	SortedMap<Integer, Event> map = events.tailMap(time);    	
    	return map.isEmpty() ? null : map.firstKey();  
    } 
}