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.rvesse.airline.utils.AirlineUtils.java

public static <K, V> Map<K, V> unmodifiableMapCopy(Map<K, V> map) {
    if (map == null)
        return Collections.emptyMap();
    return Collections.unmodifiableMap(new LinkedHashMap<K, V>(map));
}

From source file:com.linecorp.armeria.server.docs.Specification.java

private Specification(Collection<ServiceInfo> services, Collection<ClassInfo> classes) {
    final Map<String, ServiceInfo> serviceMap = new TreeMap<>();
    final Map<String, ClassInfo> classMap = new TreeMap<>();

    services.stream().forEach(s -> serviceMap.put(s.name(), s));
    classes.stream().forEach(c -> classMap.put(c.name(), c));

    this.services = Collections.unmodifiableMap(serviceMap);
    this.classes = Collections.unmodifiableMap(classMap);
}

From source file:org.jasig.portlet.emailpreview.service.auth.pp.PortletPreferencesCredentialsAuthenticationService.java

public PortletPreferencesCredentialsAuthenticationService() {
    List<ConfigurationParameter> params = new ArrayList<ConfigurationParameter>();

    ConfigurationParameter usernameParam = new ConfigurationParameter();
    usernameParam.setKey(MailPreferences.MAIL_ACCOUNT.getKey());
    usernameParam.setLabel("Mail account name");
    usernameParam.setEncryptionRequired(true);
    params.add(usernameParam);/*w  w w .j  av a2s .  c o m*/

    ConfigurationParameter passwordParam = new ConfigurationParameter();
    passwordParam.setKey(MailPreferences.PASSWORD.getKey());
    passwordParam.setLabel("Password");
    passwordParam.setEncryptionRequired(true);
    params.add(passwordParam);

    setUserParameters(Collections.unmodifiableList(params));
    setAdminParameters(Collections.<ConfigurationParameter>singletonList(
            PortletPreferencesCredentialsAuthenticationService.ACCOUNT_NAME_ATTRIBUTE));

    Map<String, ConfigurationParameter> m = new HashMap<String, ConfigurationParameter>();
    for (ConfigurationParameter param : userParameters) {
        m.put(param.getKey(), param);
    }
    setConfigParams(Collections.unmodifiableMap(m));

}

From source file:com.streamsets.datacollector.classpath.ClasspathValidatorResult.java

private ClasspathValidatorResult(String name, Set<String> unparseablePaths,
        Map<String, Map<String, List<Dependency>>> versionCollisions) {
    this.name = name;
    this.unparseablePaths = Collections.unmodifiableSet(unparseablePaths);
    this.versionCollisions = Collections.unmodifiableMap(versionCollisions);
}

From source file:edu.cornell.mannlib.vitro.webapp.web.images.PlaceholderUtil.java

private PlaceholderUtil(Map<String, String> map) {
    this.mapUrlsByClass = Collections.unmodifiableMap(new HashMap<String, String>(map));
}

From source file:com.payu.ratel.register.ServiceRegisterPostProcessor.java

/**
 * Get a map of Ratel services exported by this post processor.
 *
 * @return the unmodifiable map with entries in form: [bean name] -&gt; [bean].
 * The beans of this map are the providers of the implementation of
 * the service business interface./*from  w w  w .j a  v a 2s.co  m*/
 */
public Map<String, Object> getRegisteredServices() {
    return Collections.unmodifiableMap(registeredServices);
}

From source file:com.testtubebaby.artemismain.core.CompData.java

/**
 * Returns an unmodifiable view of the underlying map.
 * <br>Drop in a comp class into this map, get back it's unique index.
 * @return//  ww w  .  java2s .co m
 *      Returns an unmodifiable view of the underlying map.
 */
Map<Class<? extends Component>, Integer> getCompToIndMap() {
    ensureIsSealed();
    return Collections.unmodifiableMap(compToInd);
}

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

/**
 * @return the selective distinct calculation to be requested.
 *//*w  w w.ja v a2 s.c  om*/
public Map<Field, Boolean> getSelectiveCalcDistincts() {
    return Collections.unmodifiableMap(state.selectiveCalcDistinct);
}

From source file:br.com.SGIURD.utils.FileUploadWrapper.java

/**
 * Return a {@code Map<String, List<String>>} for all regular parameters.
 * Does not return any file upload parameters at all.
 *//*from   ww  w.  java  2  s .  c o m*/
@Override
public Map<String, List<String>> getParameterMap() {
    return Collections.unmodifiableMap(fRegularParams);
}

From source file:com.stormpath.spring.security.provider.StormpathUserDetails.java

private Map<String, String> createUnmodifiableMap(Account account) {
    Map<String, String> props = new HashMap<String, String>();
    props.put("href", account.getHref());
    nullSafePut(props, "username", account.getUsername());
    nullSafePut(props, "email", account.getEmail());
    nullSafePut(props, "givenName", account.getGivenName());
    nullSafePut(props, "middleName", account.getMiddleName());
    nullSafePut(props, "surname", account.getSurname());
    if (account.getStatus() != null) {
        nullSafePut(props, "status", account.getStatus().toString());
    }//  w  w  w .j  a  v a 2s. co  m
    return Collections.unmodifiableMap(props);
}