I am using Java 1.8. I have a large amount of text in a buffer. The text has some occurrences likt the following:
"... {NAME} is going to {PLACE}...", blah blah blah.
Then I have two arrays: "{NAME};{PLACE}" and "Mick Jagger;A Gogo", etc. (These are just examples). I make a Map replacements of these such as
{NAME};Mick Jagger
{PLACE};A Gogo
So I want to do all the replacements. In this case there is only 2 so it is not so cumbersome. Say my original text is in txt:
for (EntrySet<String, String> entry : replacements.entrySet()) {
txt = txt.replace(entry.getKey(), entry.getValue());
}
You can imaging if there are like a lot of replacements this could take a long time.
Is there some better way to make all the replacements, or is this basically what you would do?