import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
public class TestTokenReplacement {
public static void main(String[] args) {
Map<String, String> map = new HashMap<>();
String message = "this/is/{bad}";
map.put("bad", "good");
System.out.println(MessageFormat.format(message, map.get("bad")));
}
}
Expected output is : this/is/good How can get to format the string to replace the string tokens from the Map?