public static String [ ] fastSplitKey ( String key ) { int i = key . indexOf ( ' ' ) ; if ( - 1 == i ) { return new String [ ] { key } ; } else { int j = key . indexOf ( ' ' , i + 1 ) ; if ( - 1 != j ) { return null ; } else { return new String [ ] { key . substring ( 0 , i ) , key . substring ( i + 1 ) } ; } } }
Java s string split is very expensive due to regexes . Implement our own simple version instead .