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:com.github.restdriver.clientdriver.HttpRealRequest.java

@Override
public final Map<String, Collection<String>> getParams() {
    return Collections.unmodifiableMap(params.asMap());
}

From source file:com.oreilly.springdata.gemfire.core.Product.java

/**
 * Returns all the custom attributes of the {@link Product}.
 * /*from   w  ww .  ja  v a 2  s  . c  o  m*/
 * @return
 */
public Map<String, String> getAttributes() {
    return Collections.unmodifiableMap(attributes);
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.freemarker.ImageUploadHelper.java

private static Map<String, String> createFileTypesMap() {
    Map<String, String> map = new HashMap<String, String>();
    map.put(".gif", "image/gif");
    map.put(".png", "image/png");
    map.put(".jpg", "image/jpeg");
    map.put(".jpeg", "image/jpeg");
    map.put(".jpe", "image/jpeg");
    return Collections.unmodifiableMap(map);
}

From source file:io.swagger.test.client.ApiClient.java

public ApiClient() {
    // Use ISO 8601 format for date and datetime.
    // See https://en.wikipedia.org/wiki/ISO_8601
    this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

    // Use UTC as the default time zone.
    this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

    // Set default User-Agent.
    setUserAgent("Java-Swagger");

    // Setup authentications (key: authentication name, value: authentication).
    authentications = new HashMap<String, Authentication>();
    authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
    authentications.put("petstore_auth", new OAuth());
    // Prevent the authentications from being modified.
    authentications = Collections.unmodifiableMap(authentications);
}

From source file:com.cloudera.oryx.app.speed.als.MockALSModelUpdateGenerator.java

static Map<String, float[]> buildMatrix(int startIndex, float[]... rows) {
    Map<String, float[]> matrix = new HashMap<>(rows.length);
    int index = startIndex;
    for (float[] row : rows) {
        matrix.put(ALSUtilsTest.idToStringID(index), row);
        index++;//ww  w  . j  a  va2  s .co m
    }
    return Collections.unmodifiableMap(matrix);
}

From source file:com.haulmont.cuba.gui.theme.ThemeConstantsRepository.java

protected void init() {
    String configName = AppContext.getProperty("cuba.themeConfig");
    if (!StringUtils.isBlank(configName)) {
        Map<String, Map<String, String>> themeProperties = new HashMap<>();

        StrTokenizer tokenizer = new StrTokenizer(configName);
        for (String fileName : tokenizer.getTokenArray()) {
            String themeName = parseThemeName(fileName);
            if (StringUtils.isNotBlank(themeName)) {
                Map<String, String> themeMap = themeProperties.get(themeName);
                if (themeMap == null) {
                    themeMap = new HashMap<>();
                    themeProperties.put(themeName, themeMap);
                }//from   w  w w .  ja  v  a 2 s. c  o  m

                loadThemeProperties(fileName, themeMap);
            }
        }

        Map<String, ThemeConstants> themes = new LinkedHashMap<>();

        for (Map.Entry<String, Map<String, String>> entry : themeProperties.entrySet()) {
            themes.put(entry.getKey(), new ThemeConstants(entry.getValue()));
        }

        this.themeConstantsMap = Collections.unmodifiableMap(themes);
    } else {
        this.themeConstantsMap = Collections.emptyMap();
    }
}

From source file:ca.uhn.fhir.jpa.dao.BaseSearchParamRegistry.java

@PostConstruct
public void postConstruct() {
    Map<String, Map<String, RuntimeSearchParam>> resourceNameToSearchParams = new HashMap<String, Map<String, RuntimeSearchParam>>();

    for (IFhirResourceDao<?> nextDao : myDaos) {
        RuntimeResourceDefinition nextResDef = myCtx.getResourceDefinition(nextDao.getResourceType());
        String nextResourceName = nextResDef.getName();
        HashMap<String, RuntimeSearchParam> nameToParam = new HashMap<String, RuntimeSearchParam>();
        resourceNameToSearchParams.put(nextResourceName, nameToParam);

        for (RuntimeSearchParam nextSp : nextResDef.getSearchParams()) {
            nameToParam.put(nextSp.getName(), nextSp);
        }/* www.j  a v  a2 s .  c o m*/
    }

    myBuiltInSearchParams = Collections.unmodifiableMap(resourceNameToSearchParams);
}

From source file:com.vangent.hieos.services.xds.bridge.mapper.ContentParserConfig.java

/**
 * Method description
 *
 *
 * @return
 */
public Map<String, String> getExpressions() {
    return Collections.unmodifiableMap(expressions);
}

From source file:com.cloudera.oryx.ml.speed.als.MockModelUpdateGenerator.java

static Map<String, float[]> buildMatrix(int startIndex, double[]... rows) {
    Map<String, float[]> matrix = new HashMap<>(rows.length);
    int index = startIndex;
    for (double[] row : rows) {
        matrix.put(Integer.toString(index), VectorMath.toFloats(row));
        index++;/*from w  w  w  . j  ava 2  s.c  o  m*/
    }
    return Collections.unmodifiableMap(matrix);
}

From source file:com.brienwheeler.svc.attrs.impl.PersistentAttributeServiceBase.java

@Override
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
@MonitoredWork("getAttribute")
@GracefulShutdown/*from  w w  w.  j  a  va 2s.  com*/
public Map<String, String> getAttributes(DbId<OwnerClass> owner) {
    DbValidationUtils.assertPersisted(owner);

    List<AttrClass> attributes = persistentAttributeDao.findByOwner(owner.getId());
    Map<String, String> attributeMap = new HashMap<String, String>(attributes.size());
    for (AttrClass attribute : attributes) {
        attributeMap.put(attribute.getName(), attribute.getValue());
    }
    return Collections.unmodifiableMap(attributeMap);
}