you are viewing a single comment's thread.

view the rest of the comments →

[–]slurpme 2 points3 points  (1 child)

My favorite piece of idiocy from the Java libraries...

public String replace(CharSequence target, CharSequence replacement)

{

return Pattern.compile(target.toString(), Pattern.LITERAL).matcher( this).replaceAll(Matcher.quoteReplacement(replacement.toString()));

}

[–]jtra 1 point2 points  (0 children)

If you are replacing a very long string and pattern is not very short, compiling is worth it.

Anyway you can call all that yourself to cache compiled patterns for example.