Example usage for java.util Map forEach

List of usage examples for java.util Map forEach

Introduction

In this page you can find the example usage for java.util Map forEach.

Prototype

default void forEach(BiConsumer<? super K, ? super V> action) 

Source Link

Document

Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.

Usage

From source file:org.nanoframework.web.server.mvc.support.RedirectModel.java

@Override
public Model addAllAttributes(Map<String, Object> attributes) {
    if (attributes != null && attributes.size() > 0) {
        attributes.forEach((key, value) -> this.attributes.put(key, value));
    }/*from w  ww. j a  v  a  2 s  .c  o m*/

    return this;
}

From source file:io.curly.bloodhound.query.QueryParserTests.java

@Test
public void testMalformedQuery() throws Exception {
    String mq = "foo:bar goo:{too, yoo,loo roo:{ree rii}";
    Map<String, String> map = getMappedKeyValue(getSplits(mq));
    fix(map);//from w  w  w. j  a v a 2 s .  c o m
    map.forEach((k, v) -> System.out.println(k + " " + v));
    assertThat(map.get("goo"), equalTo("{too}"));
}

From source file:com.khartec.waltz.web.Main.java

public void start(ServerMode mode) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);

    Map<String, Endpoint> endpoints = ctx.getBeansOfType(Endpoint.class);
    endpoints.forEach((name, endpoint) -> {
        LOG.info("Registering Endpoint: {}", name);
        endpoint.register();/*from w ww  . jav a  2  s  .c o m*/
    });

    new StaticResourcesEndpoint().register();

    LOG.info("Completed endpoint registration");

    registerExceptionHandlers();
    // enableGZIP();
    enableCORS();

}

From source file:io.coala.eve3.Eve3Factory.java

protected Eve3Config getConfig(final Map<?, ?>... imports) {
    if (this.eveConfig == null) {
        this.eveConfig = this.localEveConfig == null ? ConfigCache.getOrCreate(Eve3Config.class, imports)
                : this.localEveConfig;
        if (imports != null)
            for (Map<?, ?> map : imports)
                if (map != null)
                    map.forEach((key, value) -> {
                        this.eveConfig.setProperty(key.toString(), value.toString());
                    });/*from w ww  .  jav  a  2  s  . c o m*/
        this.eveConfig.load();
    }
    return this.eveConfig;
}

From source file:com.demonwav.mcdev.platform.forge.version.ForgeVersion.java

public List<String> getForgeVersions(String version) {
    final List<String> list = new ArrayList<>();
    final Map<?, ?> numbers = (Map) map.get("number");
    numbers.forEach((k, v) -> {
        if (v instanceof Map) {
            final Map number = (Map) v;
            final String currentVersion = (String) number.get("mcversion");

            if (Objects.equal(currentVersion, version)) {
                list.add((String) number.get("version"));
            }/*from  www.  j a va2  s  .  co  m*/
        }
    });
    return list;
}

From source file:org.springframework.cache.interceptor.NameMatchCacheOperationSource.java

/**
 * Set a name/attribute map, consisting of method names
 * (e.g. "myMethod") and CacheOperation instances
 * (or Strings to be converted to CacheOperation instances).
 * @see CacheOperation/* w  w  w.j  av  a  2  s . c om*/
 */
public void setNameMap(Map<String, Collection<CacheOperation>> nameMap) {
    nameMap.forEach(this::addCacheMethod);
}

From source file:com.github.pjungermann.config.types.yaml.YamlConverter.java

protected void populate(@NotNull final Map<String, Object> config, @NotNull final Map<String, Object> other,
        @NotNull final String keyPrefix) {
    other.forEach((entryKey, entryValue) -> {
        final String key = keyPrefix + entryKey;
        populate(config, key, entryValue);
    });/*from ww  w .jav  a  2s  .c om*/
}

From source file:com.hp.autonomy.types.idol.marshalling.marshallers.jaxb2.QueueInfoResponseParser.java

QueueInfoResponseParser(final ResponseDataParser<QueueInfoGetStatusResponseData> responseDataMarshaller,
        final Map<String, Class<?>> expectedResults) {
    this.responseDataMarshaller = responseDataMarshaller;

    expectedResults.forEach((nodeName, clazz) -> {
        final Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setMappedClass(clazz);
        marshaller.setClassesToBeBound(clazz);

        this.expectedResults.put(nodeName, marshaller);
    });//w  w  w  .  j  a v a 2  s  . c o m
}

From source file:com.thoughtworks.go.plugin.access.secrets.v1.SecretsMessageConverterV1.java

private JsonObject mapToJsonObject(Map<String, String> configuration) {
    final JsonObject properties = new JsonObject();
    configuration.forEach(properties::addProperty);
    return properties;
}

From source file:org.codice.ddf.spatial.ogc.csw.catalog.transformer.AbstractGmdTransformer.java

private void copyArgumentsToContext(MarshallingContext context, Map<String, Serializable> arguments) {

    if (arguments == null) {
        return;//  ww w. j  a va2  s .c  o  m
    }

    arguments.forEach(context::put);
}