Here you can find the source of replaceAll(String inTemplate, Map
public static String replaceAll(String inTemplate, Map<String, String> inVars)
//package com.java2s; //License from project: Open Source License import java.util.Map; import java.util.Map.Entry; public class Main { public static String replaceAll(String inTemplate, Map<String, String> inVars) { if (inTemplate == null || inVars == null) { return inTemplate; }/*from w ww.ja v a 2 s .com*/ for (final Entry<String, String> e : inVars.entrySet()) { if (e.getKey() == null) { continue; } inTemplate = inTemplate.replace(e.getKey(), e.getValue() == null ? e.getKey() : e.getValue()); } return inTemplate; } }