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.surface.CubeValue.java

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

From source file:com.ikanow.aleph2.search_service.elasticsearch.utils.ElasticsearchIndexConfigUtils.java

/** Converts the bucket schema into the config bean
 * @param bucket/*w w  w.  j  ava  2s.c o m*/
 * @param backup - provides defaults from the global configuration
 * @return
 */
public static ElasticsearchIndexServiceConfigBean buildConfigBeanFromSchema(final DataBucketBean bucket,
        final ElasticsearchIndexServiceConfigBean backup, final ObjectMapper mapper) {

    final SearchIndexSchemaDefaultBean search_index_bits_tmp = Optional.ofNullable(bucket.data_schema())
            .map(DataSchemaBean::search_index_schema).filter(s -> Optional.ofNullable(s.enabled()).orElse(true))
            .map(s -> s.technology_override_schema())
            .map(map -> mapper.convertValue(map, SearchIndexSchemaDefaultBean.class))
            .orElse(backup.search_technology_override());

    // The _actual_ settings technology override object is taken from either the bucket or the backup on a top-level-field by top-leve-field basis
    final SearchIndexSchemaDefaultBean search_index_bits = BeanTemplateUtils.clone(search_index_bits_tmp)
            //(target index size is a special case)
            .with(SearchIndexSchemaDefaultBean::target_index_size_mb,
                    Optionals.of(() -> bucket.data_schema().search_index_schema().target_index_size_mb())
                            .orElse(backup.search_technology_override().target_index_size_mb()))
            .with(SearchIndexSchemaDefaultBean::collide_policy,
                    Optional.ofNullable(search_index_bits_tmp.collide_policy())
                            .orElse(backup.search_technology_override().collide_policy()))
            .with(SearchIndexSchemaDefaultBean::type_name_or_prefix,
                    Optional.ofNullable(search_index_bits_tmp.type_name_or_prefix())
                            .orElse(backup.search_technology_override().type_name_or_prefix()))
            .with(SearchIndexSchemaDefaultBean::verbose,
                    Optional.ofNullable(search_index_bits_tmp.verbose())
                            .orElse(backup.search_technology_override().verbose()))
            .with(SearchIndexSchemaDefaultBean::settings,
                    Optional.ofNullable(search_index_bits_tmp.settings())
                            .orElse(backup.search_technology_override().settings()))
            .with(SearchIndexSchemaDefaultBean::aliases,
                    Optional.ofNullable(search_index_bits_tmp.aliases())
                            .orElse(backup.search_technology_override().aliases()))
            .with(SearchIndexSchemaDefaultBean::mappings,
                    Optional.ofNullable(search_index_bits_tmp.mappings())
                            .orElse(backup.search_technology_override().mappings()))
            .with(SearchIndexSchemaDefaultBean::mapping_overrides,
                    Optional.ofNullable(search_index_bits_tmp.mapping_overrides())
                            .orElse(backup.search_technology_override().mapping_overrides()))
            .with(SearchIndexSchemaDefaultBean::tokenized_string_field,
                    Optional.ofNullable(search_index_bits_tmp.tokenized_string_field())
                            .orElse(backup.search_technology_override().tokenized_string_field()))
            .with(SearchIndexSchemaDefaultBean::untokenized_string_field,
                    Optional.ofNullable(search_index_bits_tmp.untokenized_string_field())
                            .orElse(backup.search_technology_override().untokenized_string_field()))
            .with(SearchIndexSchemaDefaultBean::dual_tokenized_string_field,
                    Optional.ofNullable(search_index_bits_tmp.dual_tokenized_string_field())
                            .orElse(backup.search_technology_override().dual_tokenized_string_field()))
            .with(SearchIndexSchemaDefaultBean::dual_untokenized_string_field,
                    Optional.ofNullable(search_index_bits_tmp.dual_untokenized_string_field())
                            .orElse(backup.search_technology_override().dual_untokenized_string_field()))
            .with(SearchIndexSchemaDefaultBean::dual_tokenize_by_default,
                    Optional.ofNullable(search_index_bits_tmp.dual_tokenize_by_default())
                            .orElse(backup.search_technology_override().dual_tokenize_by_default()))
            .with(SearchIndexSchemaDefaultBean::dual_tokenization_override,
                    Optional.ofNullable(search_index_bits_tmp.dual_tokenization_override())
                            .orElse(backup.search_technology_override().dual_tokenization_override()))
            .done();

    final ColumnarSchemaDefaultBean columnar_bits_tmp = Optional.ofNullable(bucket.data_schema())
            .map(DataSchemaBean::columnar_schema).filter(s -> Optional.ofNullable(s.enabled()).orElse(true))
            .map(s -> s.technology_override_schema())
            .map(map -> mapper.convertValue(map, ColumnarSchemaDefaultBean.class))
            .orElse(backup.columnar_technology_override());

    final ColumnarSchemaDefaultBean columnar_bits = BeanTemplateUtils.clone(columnar_bits_tmp)
            .with(ColumnarSchemaDefaultBean::default_field_data_analyzed,
                    Optional.ofNullable(columnar_bits_tmp.default_field_data_analyzed())
                            .orElse(backup.columnar_technology_override().default_field_data_analyzed()))
            .with(ColumnarSchemaDefaultBean::default_field_data_notanalyzed,
                    Optional.ofNullable(columnar_bits_tmp.default_field_data_notanalyzed())
                            .orElse(backup.columnar_technology_override().default_field_data_notanalyzed()))
            .with(ColumnarSchemaDefaultBean::enabled_field_data_analyzed,
                    Optional.ofNullable(columnar_bits_tmp.enabled_field_data_analyzed())
                            .orElse(backup.columnar_technology_override().enabled_field_data_analyzed()))
            .with(ColumnarSchemaDefaultBean::enabled_field_data_notanalyzed,
                    Optional.ofNullable(columnar_bits_tmp.enabled_field_data_notanalyzed())
                            .orElse(backup.columnar_technology_override().enabled_field_data_notanalyzed()))
            .done();

    final DataSchemaBean.TemporalSchemaBean temporal_bits_tmp = Optional.ofNullable(bucket.data_schema())
            .map(DataSchemaBean::temporal_schema).filter(s -> Optional.ofNullable(s.enabled()).orElse(true))
            .orElse(backup.temporal_technology_override());

    final DataSchemaBean.TemporalSchemaBean temporal_bits = BeanTemplateUtils.clone(temporal_bits_tmp)
            .with(DataSchemaBean.TemporalSchemaBean::technology_override_schema, Lambdas.get(() -> {
                HashMap<String, Object> tmp = new HashMap<>();
                tmp.putAll(Optional.ofNullable(temporal_bits_tmp.technology_override_schema())
                        .orElse(Collections.emptyMap()));
                tmp.putAll(
                        Optional.ofNullable(backup.temporal_technology_override().technology_override_schema())
                                .orElse(Collections.emptyMap()));
                return tmp;
            })).done();

    return BeanTemplateUtils.build(ElasticsearchIndexServiceConfigBean.class)
            .with(ElasticsearchIndexServiceConfigBean::search_technology_override, search_index_bits)
            .with(ElasticsearchIndexServiceConfigBean::columnar_technology_override, columnar_bits)
            .with(ElasticsearchIndexServiceConfigBean::temporal_technology_override, temporal_bits)
            .with(ElasticsearchIndexServiceConfigBean::document_schema_override,
                    backup.document_schema_override())
            .done().get();
}

From source file:net.spfbl.core.Defer.java

private static synchronized HashMap<String, Defer> getMap() {
    HashMap<String, Defer> map = new HashMap<String, Defer>();
    map.putAll(MAP);
    return map;/*from w w w  . j av a  2 s  .  co m*/
}

From source file:org.gradle.util.GUtil.java

public static Map addMaps(Map map1, Map map2) {
    HashMap map = new HashMap();
    map.putAll(map1);
    map.putAll(map2);/*  w  ww  . java  2  s . com*/
    return map;
}

From source file:org.apache.axis2.jaxws.context.listener.ContextListenerUtils.java

private static InputStream getStartTag(OMNamespace ns, String localPart, OMContainer parent,
        HashMap<String, String> nsElementDecls, HashMap<String, String> attrElementDecls) {
    if (log.isDebugEnabled()) {
        log.debug("Start ParsedEntityDataSource.Data.getStartTag()");
    }/*  w  w  w . jav a  2  s . c  o  m*/
    //Start creating the element.
    StringBuffer startElement = new StringBuffer();
    String prefix = (ns != null) ? ns.getPrefix() : null;
    String uri = (ns != null) ? ns.getNamespaceURI() : null;

    HashMap<String, String> nsDecls = new HashMap<String, String>();
    //Get all of the namespaces associated with Body, envelope, etc
    getParentnsdeclarations(nsDecls, parent);

    nsDecls.putAll(nsElementDecls);

    if (prefix != null && prefix.length() > 0) {
        startElement.append("<" + prefix + ":" + localPart + " ");
        if (!nsDecls.containsKey(prefix) || !nsDecls.get(prefix).equals(uri)) {
            nsDecls.put(prefix, uri);
        }
    } else {
        startElement.append("<" + localPart + " ");
    }
    addParentNs(startElement, parent, nsDecls);
    addAttrs(startElement, attrElementDecls);

    if (log.isDebugEnabled()) {
        log.debug("StartElement =" + startElement);
    }

    if (log.isDebugEnabled()) {
        log.debug("End ParsedEntityDataSource.Data.getStartTag()");
    }
    return new ByteArrayInputStream(startElement.toString().getBytes());
}

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

public static synchronized HashMap<String, Handle> getMap() {
    HashMap<String, Handle> map = new HashMap<String, Handle>();
    map.putAll(MAP);
    return map;//from  w ww .j a  va 2  s  .co m
}

From source file:org.jfrog.teamcity.agent.util.ArtifactoryClientConfigurationBuilder.java

private static void addMatrixParamProperties(BuildRunnerContext runnerContext,
        ArtifactoryClientConfiguration clientConf) {
    Properties fileAndSystemProperties = BuildInfoExtractorUtils
            .mergePropertiesWithSystemAndPropertyFile(new Properties());
    Properties filteredMatrixParams = BuildInfoExtractorUtils.filterDynamicProperties(fileAndSystemProperties,
            BuildInfoExtractorUtils.MATRIX_PARAM_PREDICATE);
    Enumeration<Object> propertyKeys = filteredMatrixParams.keys();
    while (propertyKeys.hasMoreElements()) {
        String key = propertyKeys.nextElement().toString();
        clientConf.publisher.addMatrixParam(key, filteredMatrixParams.getProperty(key));
    }/*from   www  .  j av a  2s  .  c  om*/

    HashMap<String, String> allParamMap = Maps
            .newHashMap(runnerContext.getBuildParameters().getAllParameters());
    allParamMap.putAll(((BuildRunnerContextImpl) runnerContext).getConfigParameters());
    gatherBuildInfoParams(allParamMap, clientConf.publisher, ClientProperties.PROP_DEPLOY_PARAM_PROP_PREFIX,
            Constants.ENV_PREFIX, Constants.SYSTEM_PREFIX);
}

From source file:Main.java

public static HashMap getSysParamMap(Map map) {
    HashMap hashmap = new HashMap();
    HashMap hashmap1 = new HashMap();
    hashmap.put(encodeStr("appid"), encodeStr("1uMqYWpHo3MoLH"));
    hashmap.put(encodeStr("callid"),
            encodeStr((new StringBuilder()).append("").append(generateCallId()).toString()));
    hashmap.put(encodeStr("v"), encodeStr("1.0"));
    hashmap.put(encodeStr("lang"), encodeStr(Locale.getDefault().getLanguage()));
    hashmap1.putAll(hashmap);
    if (map != null) {
        hashmap1.putAll(map);/*from   www.  j a  v a2 s. c o m*/
    }
    hashmap.put("bd_sig", generateBgsid(hashmap1));
    return hashmap;
}

From source file:Main.java

public static HashMap getParamMap(Map map) {
    HashMap hashmap = new HashMap();
    hashmap.put(encodeStr("appid"), encodeStr("1uMqYWpHo3MoLH"));
    hashmap.put(encodeStr("callid"),
            encodeStr((new StringBuilder()).append("").append(generateCallId()).toString()));
    hashmap.put(encodeStr("v"), encodeStr("1.0"));
    hashmap.put(encodeStr("lang"), encodeStr(Locale.getDefault().getLanguage()));
    if (map != null) {
        hashmap.putAll(map);
    }//www .ja va  2s .  c  om
    hashmap.put("bd_sig", generateBgsid(hashmap));
    return hashmap;
}

From source file:gov.nist.healthcare.ttt.webapp.api.GetCCDAFolderTest.java

public static HashMap<String, Object> buildJson(HashMap<String, Object> parent, String[] path) {
    if (path.length == 1) {
        if (Pattern.matches(extensionRegex, path[0])) {
            return createFile(path[0]);
        } else {//from   www. j a v  a  2 s.  c  om
            return createDir(path[0]);
        }
    } else {
        HashMap<String, Object> nextParent = createDir(path[0]);
        parent.putAll(buildJson(nextParent, Arrays.copyOfRange(path, 1, path.length)));
        return parent;
    }
}