Example usage for java.util HashMap putAll

List of usage examples for java.util HashMap putAll

Introduction

In this page you can find the example usage for java.util HashMap putAll.

Prototype

public void putAll(Map<? extends K, ? extends V> m) 

Source Link

Document

Copies all of the mappings from the specified map to this map.

Usage

From source file:com.opengamma.analytics.util.amount.CubeValue.java

/**
 * Builder from a map. A new map is created with the same values.
 * @param map The map.// ww w.  j  a v a2 s  .c o  m
 * @return The surface value.
 */
public static CubeValue from(final Map<Triple<Double, Double, Double>, Double> map) {
    ArgumentChecker.notNull(map, "Map");
    final HashMap<Triple<Double, Double, Double>, Double> data = new HashMap<>();
    data.putAll(map);
    return new CubeValue(data);
}

From source file:com.opengamma.analytics.util.amount.CubeValue.java

/**
 * Builder from a SurfaceValue. A new map is created with the same values.
 * @param surface The SurfaceValue/*from   ww w  . j  a v  a  2s .  co m*/
 * @return The surface value.
 */
public static CubeValue from(final CubeValue surface) {
    ArgumentChecker.notNull(surface, "Surface value");
    final HashMap<Triple<Double, Double, Double>, Double> data = new HashMap<>();
    data.putAll(surface.getMap());
    return new CubeValue(data);
}

From source file:org.csanchez.jenkins.plugins.kubernetes.KubernetesTestUtil.java

public static Map<String, String> getLabels(KubernetesCloud cloud, Object o) {
    HashMap<String, String> l = Maps.newHashMap(DEFAULT_LABELS);
    if (cloud != null) {
        l.putAll(cloud.getLabels());
    }/*from  ww w  .  j a  v a  2 s . co  m*/
    l.put("class", o.getClass().getSimpleName());
    return l;
}

From source file:net.spfbl.whois.NameServer.java

private static synchronized HashMap<String, NameServer> getMap() {
    HashMap<String, NameServer> map = new HashMap<String, NameServer>();
    map.putAll(NS_MAP);
    return map;//  w  w  w .  ja  v  a2  s  .co  m
}

From source file:com.opengamma.analytics.util.amount.SurfaceValue.java

/**
 * Builder from a map. A new map is created with the same values.
 * @param map The map./*from  w w  w  .  ja  v a 2 s  .  co  m*/
 * @return The surface value.
 */
public static SurfaceValue from(final Map<DoublesPair, Double> map) {
    ArgumentChecker.notNull(map, "Map");
    final HashMap<DoublesPair, Double> data = new HashMap<>();
    data.putAll(map);
    return new SurfaceValue(data);
}

From source file:com.opengamma.analytics.util.amount.SurfaceValue.java

/**
 * Builder from a SurfaceValue. A new map is created with the same values.
 * @param surface The SurfaceValue//  w w w  .  j a v a 2 s  . co m
 * @return The surface value.
 */
public static SurfaceValue from(final SurfaceValue surface) {
    ArgumentChecker.notNull(surface, "Surface value");
    final HashMap<DoublesPair, Double> data = new HashMap<>();
    data.putAll(surface.getMap());
    return new SurfaceValue(data);
}

From source file:Maps.java

public static <K, V> Map<K, V> putAll(Map<K, V> map, Map<K, V> toAdd) {
    switch (toAdd.size()) {
    case 0://from  w ww .ja v a  2s  .  co m
        // No-op.
        return map;
    case 1: {
        // Add one element.
        K key = toAdd.keySet().iterator().next();
        return put(map, key, toAdd.get(key));
    }
    default:
        // True list merge, result >= 2.
        switch (map.size()) {
        case 0:
            return new HashMap<K, V>(toAdd);
        case 1: {
            HashMap<K, V> result = new HashMap<K, V>();
            K key = map.keySet().iterator().next();
            result.put(key, map.get(key));
            result.putAll(toAdd);
            return normalize(result);
        }
        default:
            map.putAll(toAdd);
            return map;
        }
    }
}

From source file:com.opengamma.analytics.util.surface.SurfaceValue.java

/**
 * Builder from a map. A new map is created with the same values.
 * @param map The map.//from ww  w .j a  va  2 s.c o  m
 * @return The surface value.
 */
public static SurfaceValue from(final Map<DoublesPair, Double> map) {
    Validate.notNull(map, "Map");
    HashMap<DoublesPair, Double> data = new HashMap<DoublesPair, Double>();
    data.putAll(map);
    return new SurfaceValue(data);
}

From source file:com.opengamma.analytics.util.surface.SurfaceValue.java

/**
 * Builder from a SurfaceValue. A new map is created with the same values.
 * @param surface The SurfaceValue//from w  w w  .jav a 2 s  .  c  o  m
 * @return The surface value.
 */
public static SurfaceValue from(final SurfaceValue surface) {
    Validate.notNull(surface, "Surface value");
    HashMap<DoublesPair, Double> data = new HashMap<DoublesPair, Double>();
    data.putAll(surface.getMap());
    return new SurfaceValue(data);
}

From source file:com.opengamma.analytics.util.surface.CubeValue.java

/**
 * Builder from a map. A new map is created with the same values.
 * @param map The map./* w  ww  . j av a  2  s  .  c o m*/
 * @return The surface value.
 */
public static CubeValue from(final Map<Triple<Double, Double, Double>, Double> map) {
    Validate.notNull(map, "Map");
    HashMap<Triple<Double, Double, Double>, Double> data = new HashMap<Triple<Double, Double, Double>, Double>();
    data.putAll(map);
    return new CubeValue(data);
}