Code example for SortedMap

Methods: firstKey, get, isEmpty

0
     */ 
    protected String map(CandidateURI cauri) {
        // get classKey, via frontier to generate if necessary 
        String classKey = getController().getFrontier().getClassKey(cauri);
        SortedMap tail = map.tailMap(classKey);
        if(tail.isEmpty()) {
            // wraparound 
            tail = map;
        } 
        // target node is value of nearest subsequent key 
        return (String) tail.get(tail.firstKey());
    } 
 
    protected void initialTasks() { 
        super.initialTasks(); 
        try { 
            loadMap(); 
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }