private boolean isFastPath(String regex) {
        char ch;
        return (((regex.length() == 1 && ".$|()[{^?*+\\".indexOf(ch = regex.charAt(0)) == -1) || (regex.length() == 2
                && regex.charAt(0) == '\\' && (((ch = regex.charAt(1)) - '0') | ('9' - ch)) < 0 && ((ch - 'a') | ('z' - ch)) < 0 && ((ch - 'A') | ('Z' - ch)) < 0)) && (ch < Character.MIN_HIGH_SURROGATE || ch > Character.MAX_LOW_SURROGATE));
    }
private boolean isFastPath ( String regex ) { char ch ; return ( ( ( regex . length ( ) == 1 && ".$|()[{^?*+\\" . indexOf ( ch = regex . charAt ( 0 ) ) == - 1 ) || ( regex . length ( ) == 2 && regex . charAt ( 0 ) == '\\' && ( ( ( ch = regex . charAt ( 1 ) ) - '0' ) | ( '9' - ch ) ) < 0 && ( ( ch - 'a' ) | ( 'z' - ch ) ) < 0 && ( ( ch - 'A' ) | ( 'Z' - ch ) ) < 0 ) ) && ( ch < Character . MIN_HIGH_SURROGATE || ch > Character . MAX_LOW_SURROGATE ) ) ; }
Since JDK 1.7 there's a special branch in String.split which works very fast for one-character pattern
We do not report a bug if this case takes place
(in fact precompilation will make split much slower since this fast path doesn't use regexp engine at all)
@param regex regex to test whether it's suitable for the fast path
@return true if fast path is possible