Scala's StringLike has the method
replaceAllLiterally(literal: String, replacement: String): String
This seems to be very similar in effect to Java's String with the method
String replace(CharSequence target, CharSequence replacement)
Is there ever a reason to use the Scala version?
(Not going through the regex compile step would seem to enable Java's version to be faster, though I haven't benchmarked that)
It's to avoid collision with
StringBuilder is also a
StringLike. Why the
replace wasn't the one to be changed, I'm not sure.
There's no reason to use it on strings unless you want to handle any
StringLike (i.e. both wrapped strings and their builders).