Review patches isBMPCodePoint/2/3

Martin Buchholz martinrb at google.com
Thu Mar 25 21:47:06 UTC 2010


Here's another minor performance tweak to

    public String(int[] codePoints, int offset, int count) {

that optimizes for BMP.

        // Pass 1: Compute precise size of char[]
        int n = count;
        for (int i = offset; i < end; i++) {
            int c = codePoints[i];
            if (Character.isBMPCodePoint(c))
                ;
            else if (Character.isSupplementaryCodePoint(c))
                n++;
            else throw new IllegalArgumentException(Integer.toString(c));
        }

http://cr.openjdk.java.net/~martin/webrevs/openjdk7/public-isBMPCodePoint/

Martin



More information about the core-libs-dev mailing list