/** * Returns a {@code char} matcher functionally equivalent to this one, but * with its configuration cached in an eight-kilobyte bit array. In some * situations this produces a matcher which is faster to query than the * original; your mileage may vary. * * <p>The default implementation creates a new bit array and passes it to * {@link #setBits(LookupTable)}. */ public CharMatcher precomputed() { final LookupTable table = new LookupTable(); setBits(table); return new CharMatcher() { @Override public boolean matches(char c) { return table.get(c); } @Override public CharMatcher precomputed() { return this; } }; }
/** * Returns a {@code char} matcher functionally equivalent to this one, but * with its configuration cached in an eight-kilobyte bit array. In some * situations this produces a matcher which is faster to query than the * original; your mileage may vary. * * <p>The default implementation creates a new bit array and passes it to * {@link #setBits(LookupTable)}. */ public CharMatcher precomputed() { final LookupTable table = new LookupTable(); setBits(table); return new CharMatcher() { @Override public boolean matches(char c) { return table.get(c); } @Override public CharMatcher precomputed() { return this; } }; }
/** * Returns a {@code char} matcher functionally equivalent to this one, but * with its configuration cached in an eight-kilobyte bit array. In some * situations this produces a matcher which is faster to query than the * original; your mileage may vary. * * <p>The default implementation creates a new bit array and passes it to * {@link #setBits(LookupTable)}. */ public CharMatcher precomputed() { final LookupTable table = new LookupTable(); setBits(table); return new CharMatcher() { @Override public boolean matches(char c) { return table.get(c); } @Override public CharMatcher precomputed() { return this; } }; }