public static String next ( CharSequence self ) { StringBuilder buffer = new StringBuilder ( self ) ; if ( buffer . length ( ) == 0 ) { buffer . append ( Character . MIN_VALUE ) ; } else { char last = buffer . charAt ( buffer . length ( ) - 1 ) ; if ( last == Character . MAX_VALUE ) { buffer . append ( Character . MIN_VALUE ) ; } else { char next = last ; next ++ ; buffer . setCharAt ( buffer . length ( ) - 1 , next ) ; } } return buffer . toString ( ) ; }
This method is called by the ++ operator for the class CharSequence . It increments the last character in the given CharSequence . If the last character in the CharSequence is Character . MAX_VALUE a Character . MIN_VALUE will be appended . The empty CharSequence is incremented to a string consisting of the character Character . MIN_VALUE .