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:edu.cornell.mannlib.vitro.webapp.controller.individual.IndividualController.java

private static Map<String, Float> initializeContentTypes() {
    HashMap<String, Float> map = new HashMap<String, Float>();
    map.put(HTML_MIMETYPE, 0.5f);
    map.put(XHTML_MIMETYPE, 0.5f);/*from  w  ww .  ja va 2 s .  co  m*/
    map.put("application/xml", 0.5f);
    map.put(JSON_MIMETYPE, 1.0f);
    map.put(JSON_LD_MIMETYPE, 1.0f);
    map.put(RDFXML_MIMETYPE, 1.0f);
    map.put(RDFXML_MIMETYPE, 1.0f);
    map.put(N3_MIMETYPE, 1.0f);
    map.put(TTL_MIMETYPE, 1.0f);
    return Collections.unmodifiableMap(map);
}

From source file:Main.java

public static <K, V> Map<K, V> unmodifiableMap(final Map<? extends K, ? extends V> m, final boolean newMap,
        final boolean emptyAsNull) {
    if (m == null) {
        return null;
    }/*from ww  w  .  jav a  2s.c  o  m*/

    if (emptyAsNull && m.isEmpty()) {
        return null;
    }

    return Collections.unmodifiableMap(newMap ? new HashMap<>(m) : m);
}

From source file:com.amazonaws.services.dynamodbv2.xspec.GetItemExpressionSpec.java

GetItemExpressionSpec(ExpressionSpecBuilder builder) {
    SubstitutionContext context = new SubstitutionContext();
    this.projectionExpression = builder.buildProjectionExpression(context);
    final Map<String, String> nameMap = context.getNameMap();
    this.nameMap = nameMap == null ? null : Collections.unmodifiableMap(nameMap);
}

From source file:fr.mby.portal.coreimpl.preferences.BasicAppPreferences.java

@Override
public Map<String, String[]> getMap() {
    return Collections.unmodifiableMap(this.preferences);
}

From source file:io.bosh.client.deployments.Deployment.java

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

From source file:com.frank.search.solr.core.query.result.SimpleFieldStatsResult.java

@Override
public Map<String, Map<String, StatsResult>> getFacetStatsResults() {
    return Collections.unmodifiableMap(facetStatsResult);
}

From source file:com.antsdb.saltedfish.sql.SessionParameters.java

public Map<String, Object> getParameters() {
    return Collections.unmodifiableMap(this.parameters);
}

From source file:org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter.java

private static Map<String, Adapter> createMethodAdapters() {
    Map<String, Adapter> map = new HashMap<>();
    map.put("GET", new GetAdapter());
    map.put("POST", new PostAdapter());
    map.put("PUT", new PutAdapter());
    map.put("DELETE", new DeleteAdapter());
    map.put("OPTIONS", new OptionsAdapter());
    return Collections.unmodifiableMap(map);
}

From source file:Main.java

/**
 * @param entries// www. j  a  v  a  2 s.c  om
 *            the <i>final</i> set of entries to add to the newly created
 *            <i>unmodifiable</i> map
 * @return an <i>unmodifiable</i> map with all given entries
 */
@SafeVarargs
public static <K, V> Map<K, V> map(Entry<K, V>... entries) {
    return Collections
            .unmodifiableMap(Arrays.stream(entries).collect(Collectors.toMap(Entry::getKey, Entry::getValue)));
}

From source file:com.tbodt.jswerve.Headers.java

private Headers(Map<String, String> headers) {
    this.headersMap = Collections.unmodifiableMap(headers);
}