Example usage for java.util Collections unmodifiableMap

List of usage examples for java.util Collections unmodifiableMap

Introduction

In this page you can find the example usage for java.util Collections unmodifiableMap.

Prototype

public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Returns an unmodifiable view of the specified map.

Usage

From source file:io.github.carlomicieli.footballdb.starter.parsers.TeamRosterParser.java

private static Map<String, String> rosterEntryValues(Element e) {
    Map<String, String> values = new HashMap<>();

    values.put("number", childValueAsString(e, 0).orElse(null));
    values.put("profile", e.children().get(1).getElementsByTag("a").attr("href"));
    values.put("name", e.children().get(1).getElementsByTag("a").text());
    values.put("position", childValueAsString(e, 2).orElse(null));
    values.put("status", childValueAsString(e, 3).orElse(null));
    values.put("height", childValueAsString(e, 4).orElse(null));
    values.put("weight", childValueAsString(e, 5).orElse(null));
    values.put("birth_date", childValueAsString(e, 6).orElse(null));
    values.put("exp", childValueAsString(e, 7).orElse(null));
    values.put("college", childValueAsString(e, 8).orElse(null));

    return Collections.unmodifiableMap(values);
}

From source file:org.web4thejob.message.DefaultMessage.java

@Override
public Map<MessageArgEnum, Object> getArgs() {
    return Collections.unmodifiableMap(args);
}

From source file:com.snowstore.mercury.core.health.Health.java

/**
 * Create a new {@link Health} instance with the specified status and
 * details.//from ww  w .j  av a2  s .  co m
 * 
 * @param builder
 *            the Builder to use
 */
private Health(Builder builder) {
    this.status = builder.status;
    this.details = Collections.unmodifiableMap(builder.details);
}

From source file:com.scvngr.levelup.core.net.AbstractResponseTest.java

@SmallTest
public void testConstructor_withHttpHeaders() {
    final Map<String, List<String>> headers = new HashMap<String, List<String>>();
    final String contentLength = "Content-Length";
    final String contentType = "Content-Type";
    final String emptyList = "Empty-List";
    headers.put(contentLength, Arrays.asList(new String[] { "0" }));

    // Pretend that there are accidentally two headers.
    headers.put(contentType, Arrays.asList(new String[] { "application/json", "text/plain" }));

    // Empty list.
    headers.put(emptyList, Arrays.asList(new String[] {}));

    headers.put("X-Foo", null);

    final AbstractResponseUnderTest response = new AbstractResponseUnderTest(HttpStatus.SC_OK,
            Collections.unmodifiableMap(headers), null);

    assertEquals("0", response.getHttpHeader(contentLength));
    assertNull(response.getHttpHeader("content-length")); // does not normalize yet
    assertNull(response.getHttpHeader("X-Kitteh"));
    assertNull(response.getHttpHeader("X-Foo"));
    assertNull(response.getHttpHeader(emptyList));

    assertEquals("application/json", response.getHttpHeader(contentType));
}

From source file:com.smartitengineering.cms.ws.resources.ResourcesConfig.java

public Map<String, String> getAllProperties() {
    return Collections.unmodifiableMap(new LinkedHashMap(properties));
}

From source file:com.adaptris.hpcc.JobStatusParser.java

private Map<String, JobState> initMappings() {
    Map<String, JobState> map = new HashMap<>();
    for (JobState s : JobState.values()) {
        if (s == JobState.finished) {
            map.put(String.format("%s Finished", workUnit), s);
        } else {/*from  w  ww . j a  v  a2s. c o m*/
            map.put(String.format("%s status: %s", workUnit, s.name()), s);
        }
    }
    return Collections.unmodifiableMap(map);
}

From source file:org.hawkular.services.rest.test.AbstractTestBase.java

public static TestClient newClient(String tenantId) {
    final Map<String, String> defaultHeaders = Collections.unmodifiableMap(new HashMap<String, String>() {
        /**  *///from  w  w w.j  av a  2  s. c  om
        private static final long serialVersionUID = 1L;
        {
            put("Authorization", authHeader);
            put("Accept", "application/json");
            put("Hawkular-Tenant", tenantId);
        }
    });
    return new TestClient(client, mapper, baseUri, defaultHeaders);
}

From source file:org.basinmc.maven.plugins.minecraft.launcher.VersionIndex.java

public VersionIndex(
        @Nonnull @JsonProperty(value = "versions", required = true) List<VersionDescriptor> versions) {
    HashMap<String, VersionDescriptor> map = new HashMap<>();
    {/*from   w w  w  .j  ava 2 s.  c o  m*/
        for (VersionDescriptor version : versions) {
            map.put(version.getId(), version);
        }
    }
    this.maps = Collections.unmodifiableMap(map);
}

From source file:com.stratio.deep.cassandra.config.EntityDeepJobConfig.java

/**
 * {@inheritDoc}//  w  w  w .  j a  v  a2s.co  m
 */
@Override
public CassandraDeepJobConfig<T> initialize() {
    super.initialize();

    Map<String, String> tmpMap = new HashMap<>();

    Field[] deepFields = AnnotationUtils.filterDeepFields(entityClass);

    for (Field f : deepFields) {
        String dbName = AnnotationUtils.deepFieldName(f);
        String beanFieldName = f.getName();

        tmpMap.put(dbName, beanFieldName);
    }

    mapDBNameToEntityName = Collections.unmodifiableMap(tmpMap);

    return this;
}

From source file:ch.ralscha.extdirectspring.bean.MetaData.java

public Map<String, Object> getMetaData() {
    return Collections.unmodifiableMap(metaData);
}