Java Map Remove removeNamespaces(Map properties)

Here you can find the source of removeNamespaces(Map properties)

Description

remove Namespaces

License

Open Source License

Declaration

public static Map removeNamespaces(Map properties) 

Method Source Code

//package com.java2s;
/*/*  w w w .j av a 2s. c  o m*/
 * $Id$
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

import java.util.HashMap;
import java.util.Iterator;

import java.util.Map;

public class Main {
    public static Map removeNamespaces(Map properties) {
        HashMap props = new HashMap(properties.size());
        Map.Entry entry;
        for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) {
            entry = (Map.Entry) iter.next();
            props.put(removeNamespacePrefix((String) entry.getKey()), entry.getValue());

        }
        return props;
    }

    public static String removeNamespacePrefix(String eleName) {
        int i = eleName.lastIndexOf('.');
        return (i == -1 ? eleName : eleName.substring(i + 1, eleName.length()));
    }
}

Related

  1. removeHeader(Map headers, String header)
  2. removeKeyAndConvertToListOfMaps( Object obj, String key)
  3. removeKeys(Collection keys, Map map)
  4. removeKeysWithPrefix(Map map, String prefix)
  5. removeMapEntryFromPreferenceStoredMap(String keyOfPreference, String keyInMap)
  6. removeNode(Map map, List pathItems)
  7. removeNullEntries(Map map)
  8. removeNullPair(Map map)
  9. removeNullValues(final Map parameters)