Formatting
This commit is contained in:
parent
ef0cfe2f2e
commit
311fad500d
|
@ -50,13 +50,13 @@ class Sys {
|
||||||
|
|
||||||
public static
|
public static
|
||||||
void eraseString(String string) {
|
void eraseString(String string) {
|
||||||
// You can change the value of the inner char[] using reflection.
|
// You can change the value of the inner char[] using reflection.
|
||||||
//
|
//
|
||||||
// You must be careful to either change it with an array of the same length,
|
// You must be careful to either change it with an array of the same length,
|
||||||
// or to also update the count field.
|
// or to also update the count field.
|
||||||
//
|
//
|
||||||
// If you want to be able to use it as an entry in a set or as a value in map,
|
// If you want to be able to use it as an entry in a set or as a value in map,
|
||||||
// you will need to recalculate the hash code and set the value of the hashCode field.
|
// you will need to recalculate the hash code and set the value of the hashCode field.
|
||||||
|
|
||||||
//noinspection TryWithIdenticalCatches
|
//noinspection TryWithIdenticalCatches
|
||||||
try {
|
try {
|
||||||
|
@ -94,19 +94,14 @@ class Sys {
|
||||||
/**
|
/**
|
||||||
* FROM: https://www.cqse.eu/en/blog/string-replace-performance/
|
* FROM: https://www.cqse.eu/en/blog/string-replace-performance/
|
||||||
* <p/>
|
* <p/>
|
||||||
* Replaces all occurrences of keys of the given map in the given string
|
* Replaces all occurrences of keys of the given map in the given string with the associated value in that map.
|
||||||
* with the associated value in that map.
|
|
||||||
* <p/>
|
* <p/>
|
||||||
* This method is semantically the same as calling
|
* This method is semantically the same as calling {@link String#replace(CharSequence, CharSequence)} for each of the
|
||||||
* {@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
|
||||||
* entries in the map, but may be significantly faster for many replacements
|
* {@link String#replace(CharSequence, CharSequence)} uses regular expressions internally and results in many String
|
||||||
* performed on a short string, since
|
* object allocations when applied iteratively.
|
||||||
* {@link String#replace(CharSequence, CharSequence)} uses regular
|
|
||||||
* expressions internally and results in many String object allocations when
|
|
||||||
* applied iteratively.
|
|
||||||
* <p/>
|
* <p/>
|
||||||
* The order in which replacements are applied depends on the order of the
|
* The order in which replacements are applied depends on the order of the map's entry set.
|
||||||
* map's entry set.
|
|
||||||
*/
|
*/
|
||||||
public static
|
public static
|
||||||
String replaceStringFast(String string, Map<String, String> replacements) {
|
String replaceStringFast(String string, Map<String, String> replacements) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user