Example usage for org.apache.commons.collections.map MultiValueMap putAll

List of usage examples for org.apache.commons.collections.map MultiValueMap putAll

Introduction

In this page you can find the example usage for org.apache.commons.collections.map MultiValueMap putAll.

Prototype

public void putAll(Map map) 

Source Link

Document

Override superclass to ensure that MultiMap instances are correctly handled.

Usage

From source file:com.nextep.datadesigner.impl.Observable.java

/**
 * @return a snapshot of all currently registered listener
 *//*from w w w. j  a v  a2s.c o m*/
public static Object getSnapshot() {
    MultiValueMap snap = new MultiValueMap();
    snap.putAll(snapshot);
    return snap;
}

From source file:org.apache.ambari.server.state.stack.StackRoleCommandOrder.java

/**
 * merge StackRoleCommandOrder content with parent
 *
 * @param parent parent StackRoleCommandOrder instance
 *//*from  w w w.java2 s  .c  o m*/

public void merge(StackRoleCommandOrder parent) {

    HashMap<String, Object> mergedRoleCommandOrders = new HashMap<String, Object>();
    HashMap<String, Object> parentData = parent.getContent();

    List<String> keys = Arrays.asList(GENERAL_DEPS_KEY, GLUSTERFS_DEPS_KEY, NO_GLUSTERFS_DEPS_KEY,
            NAMENODE_HA_DEPS_KEY, RESOURCEMANAGER_HA_DEPS_KEY);

    for (String key : keys) {
        if (parentData.containsKey(key) && content.containsKey(key)) {
            Map<String, Object> result = new HashMap<String, Object>();
            Map<String, Object> parentProperties = (Map<String, Object>) parentData.get(key);
            Map<String, Object> childProperties = (Map<String, Object>) content.get(key);
            MultiValueMap childAndParentProperties = new MultiValueMap();
            childAndParentProperties.putAll(childProperties);
            childAndParentProperties.putAll(parentProperties);
            for (Object property : childAndParentProperties.keySet()) {
                List propertyValues = (List) childAndParentProperties.get(property);
                result.put((String) property, propertyValues.get(0));
            }
            mergedRoleCommandOrders.put(key, result);
        } else if (content.containsKey(key)) {
            mergedRoleCommandOrders.put(key, content.get(key));
        } else if (parentData.containsKey(key)) {
            mergedRoleCommandOrders.put(key, parentData.get(key));
        }
    }
    this.content = mergedRoleCommandOrders;
}