protected String findUpperLimit(String prefix){
  if (prefix.isEmpty()) {
    return "z";
  }
  if (prefix.length() == 1) {
    char c=prefix.charAt(0);
    return c < 'z' ? Character.toString((char)(c + 1)) : "z";
  }
  char lastChar=prefix.charAt(prefix.length() - 1);
  if (lastChar < 'z') {
    return prefix.substring(0,prefix.length() - 1) + Character.toString((char)(lastChar + 1));
  }
  return findUpperLimit(prefix.substring(0,prefix.length() - 1));
}

protected String findUpperLimit ( String prefix ) { if ( prefix . isEmpty ( ) ) { return "z" ; } if ( prefix . length ( ) == 1 ) { char c = prefix . charAt ( 0 ) ; return c < 'z' ? Character . toString ( ( char ) ( c + 1 ) ) : "z" ; } char lastChar = prefix . charAt ( prefix . length ( ) - 1 ) ; if ( lastChar < 'z' ) { return prefix . substring ( 0 , prefix . length ( ) - 1 ) + Character . toString ( ( char ) ( lastChar + 1 ) ) ; } return findUpperLimit ( prefix . substring ( 0 , prefix . length ( ) - 1 ) ) ; }
find the upper limit of the treeset map lookup . e . g . " git " has a upper lookup limit of " giu " ( exclusive ) .
