Formatting
This commit is contained in:
parent
ef0cfe2f2e
commit
311fad500d
|
@ -94,19 +94,14 @@ class Sys {
|
|||
/**
|
||||
* FROM: https://www.cqse.eu/en/blog/string-replace-performance/
|
||||
* <p/>
|
||||
* Replaces all occurrences of keys of the given map in the given string
|
||||
* with the associated value in that map.
|
||||
* Replaces all occurrences of keys of the given map in the given string with the associated value in that map.
|
||||
* <p/>
|
||||
* This method is semantically the same as calling
|
||||
* {@link String#replace(CharSequence, CharSequence)} for each of the
|
||||
* entries in the map, but may be significantly faster for many replacements
|
||||
* performed on a short string, since
|
||||
* {@link String#replace(CharSequence, CharSequence)} uses regular
|
||||
* expressions internally and results in many String object allocations when
|
||||
* applied iteratively.
|
||||
* This method is semantically the same as calling {@link String#replace(CharSequence, CharSequence)} for each of the
|
||||
* entries in the map, but may be significantly faster for many replacements performed on a short string, since
|
||||
* {@link String#replace(CharSequence, CharSequence)} uses regular expressions internally and results in many String
|
||||
* object allocations when applied iteratively.
|
||||
* <p/>
|
||||
* The order in which replacements are applied depends on the order of the
|
||||
* map's entry set.
|
||||
* The order in which replacements are applied depends on the order of the map's entry set.
|
||||
*/
|
||||
public static
|
||||
String replaceStringFast(String string, Map<String, String> replacements) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user