Java Map Replace replaceKeyCharacter(Map map, char oldChar, char newChar)

Here you can find the source of replaceKeyCharacter(Map map, char oldChar, char newChar)

Description

replace Key Character

License

Open Source License

Declaration

public static Map<String, Object> replaceKeyCharacter(Map<String, Object> map, char oldChar, char newChar) 

Method Source Code

//package com.java2s;
/**/*  w  w w  .jav  a  2 s .co  m*/
 * This file is part of Graylog Beats Plugin.
 *
 * Graylog Beats Plugin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Graylog Beats Plugin is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Graylog Beats Plugin.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static Map<String, Object> replaceKeyCharacter(Map<String, Object> map, char oldChar, char newChar) {
        final Map<String, Object> result = new HashMap<>(map.size());
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            final String key = entry.getKey().replace(oldChar, newChar);
            final Object value = entry.getValue();
            result.put(key, value);
        }
        return result;
    }
}

Related

  1. replaceFromMap(String string, Map replacements)
  2. replaceGlobalTokensFromMap(Map dataMap, String message)
  3. replaceInvalid(String uri, Map reps)
  4. replaceKey(final Map map, final TKey oldkey, final TKey newkey)
  5. replaceKey(Map map, K oldKey, K newKey)
  6. replaceKeyword(String messageTemplate, Map args, String key)
  7. replaceMap(String inStr, Map replaceMap)
  8. replaceMethodUriWithValues(String methodUri, Map urlParameterKeyValues)
  9. replaceNode(Map map, Map replacement, List pathItems)