List of utility methods to do Map Replace
String | replaceCharacters(String sequence, Map replace Characters if (reverse) { for (Entry<String, String> entry : map.entrySet()) { sequence = sequence.replace(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())); } else { for (Entry<String, String> entry : map.entrySet()) { sequence = sequence.replace(String.valueOf(entry.getValue()), String.valueOf(entry.getKey())); return sequence; |
char[] | replaceCharactersInArray(char[] characters, Map Replaces each instance of any character in the specified map with its corresponding replacement character in a new array of characters that is otherwise equivalent to the specified array of characters. int charactersLength = characters.length; char[] replaced = new char[charactersLength]; for (int index = 0; index < charactersLength; index++) { char character = characters[index]; Character replacement = replacements.get(character); if (replacement == null) { replaced[index] = character; } else { ... |
void | replaceElements(Map replace Elements if (destinationMap != null && sourceMap != null) {
destinationMap.clear();
destinationMap.putAll(sourceMap);
|
String | replaceEntities(final Map This function takes the Map generated by the calculateEntityReplacements function, and uses those values to replace any entities in the XML string with their unique random integer replacements. String retValue = xml; for (final String entity : replacements.keySet()) retValue = retValue.replaceAll("\\&" + entity + ";", replacements.get(entity)); return retValue; |
String | replaceFromMap(final String string, final Map replace From Map StringBuilder sb = new StringBuilder(string); for (Map.Entry<String, String> entry : replacements.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); final int start = sb.indexOf(key, 0); replaceString(sb, key, value, start); return sb.toString(); ... |
String | replaceFromMap(String string, Map Replaces all occurrences of keys of the given map in the given string with the associated value in that map. if (replacements == null) { return string; StringBuilder sb = new StringBuilder(string); for (Entry<String, String> entry : replacements.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); int start = sb.indexOf(key, 0); ... |
String | replaceGlobalTokensFromMap(Map Replace global tokens with their map correspondents. String result = message; int beginDelim = 0; while ((beginDelim = result.indexOf("%gbl.")) >= 0) { int endDelim = result.indexOf("%", beginDelim + 1); String varName = result.substring(beginDelim + 1, endDelim); if (dataMap.containsKey(varName)) { result = result.replaceAll(result.substring(beginDelim, endDelim + 1), (String) dataMap.get(varName)); ... |
String | replaceInvalid(String uri, Map replace Invalid StringBuilder builder = new StringBuilder(); for (char curChar : uri.toCharArray()) { String charStr = String.valueOf(curChar); if (reps.containsKey(charStr)) { builder.append("%" + reps.get(charStr)); } else { builder.append(charStr); return builder.toString(); |
void | replaceKey(final Map replace Key if (map != null && map.containsKey(oldkey)) { map.put(newkey, map.get(oldkey)); } else { throw new IllegalArgumentException("Map must be effective and contain the old key."); |
void | replaceKey(Map Remove the entry with 'oldKey' and put it (if exists) using 'newKey' unless if an entry already exist for 'newKey'. if (map == null || map.isEmpty()) { return; if (map.containsKey(newKey)) { return; V o = map.remove(oldKey); if (o != null) { ... |