Code example for SortedMap

Methods: getisEmptyfirstKey

        return resources.get(getShardInfo(key));
    public S getShardInfo(byte[] key) {
        SortedMap<Long, S> tail = nodes.tailMap(algo.hash(key));
        if (tail.isEmpty()) {
            return nodes.get(nodes.firstKey());
        return tail.get(tail.firstKey());
    public S getShardInfo(String key) {
        return getShardInfo(SafeEncoder.encode(getKeyTag(key)));
     * A key tag is a special pattern inside a key that, if preset, is the only 
     * part of the key hashed in order to select the server for this key. 
     * @see