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.cettia.transport.http.HttpTransportServer.java

/**
 * For internal use only./*from  w w  w. ja  va  2s  . co  m*/
 */
public static Map<String, String> parseQuery(String uri) {
    Map<String, String> map = new LinkedHashMap<>();
    String query = URI.create(uri).getQuery();
    if (query == null || query.equals("")) {
        return Collections.unmodifiableMap(map);
    }
    String[] params = query.split("&");
    for (String param : params) {
        try {
            String[] pair = param.split("=", 2);
            String name = URLDecoder.decode(pair[0], "UTF-8");
            if (name.equals("")) {
                continue;
            }
            map.put(name, pair.length > 1 ? URLDecoder.decode(pair[1], "UTF-8") : "");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
    return Collections.unmodifiableMap(map);
}

From source file:com.arpnetworking.clusteraggregator.configuration.ClusterAggregatorConfiguration.java

public Map<String, ?> getAkkaConfiguration() {
    return Collections.unmodifiableMap(_akkaConfiguration);
}

From source file:org.hawkular.apm.server.api.utils.zipkin.BinaryAnnotationMappingStorage.java

private void loadMappings(String path) {
    try {/*from www  . j  av a  2  s .com*/
        String file = readFile(new File(path));

        TypeReference<Map<String, BinaryAnnotationMapping>> typeReference = new TypeReference<Map<String, BinaryAnnotationMapping>>() {
        };

        ObjectMapper objectMapper = new ObjectMapper();
        JsonParser parser = objectMapper.getFactory().createParser(file);

        keyBasedMappings = Collections.unmodifiableMap(parser.readValueAs(typeReference));
    } catch (IOException ex) {
        log.errorf("Could not load Zipkin binary annotation mapping file %s", path);
        keyBasedMappings = Collections.emptyMap();
    }
}

From source file:anhttpclient.impl.request.HttpPostWebRequest.java

/**
 * {@inheritDoc}
 */
public Map<String, String> getFormParams() {
    return Collections.unmodifiableMap(formParams);
}

From source file:cc.osint.graphd.sim.ProcessGroup.java

public Map<String, GraphProcess<T, M>> ps() throws Exception {
    return Collections.unmodifiableMap(processMap);
}

From source file:com.clustercontrol.commons.util.MonitoredThreadPoolExecutor.java

public static Map<Long, ThreadInfo> getRunningThreadMap() {
    return Collections.unmodifiableMap(runningTaskMap);
}

From source file:com.norconex.importer.handler.tagger.impl.ConstantTagger.java

public Map<String, List<String>> getConstants() {
    return Collections.unmodifiableMap(constants);
}

From source file:com.twinsoft.convertigo.engine.util.HttpServletRequestTwsWrapper.java

public Map<String, String[]> getParameterMap() {
    return Collections.unmodifiableMap(parameters);
}

From source file:org.mule.modules.bitly.MuleBitlyModule.java

@PostConstruct
public void postConstruct() {
    if (null == this.restTemplate) {
        this.restTemplate = new RestTemplate();
    }/*www.  j av a  2 s  .  c  o m*/

    Map<String, String> p = new HashMap<String, String>();
    p.put("login", getLogin());
    p.put("apiKey", getApiKey());
    p.put("format", FORMAT);

    this.PARAMS = Collections.unmodifiableMap(p);
}

From source file:org.kmnet.com.fw.common.codelist.NumberRangeCodeList.java

/**
 * Initializes the codelist with the range of numbers.<br>
 * <p>/*from  w w w.j  a  v a 2  s.co m*/
 * <code>to</code> must be more than <code>from</code>.
 * </p>
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 * @throws IllegalArgumentException when if from is greater than to.
 */
@Override
public void afterPropertiesSet() {
    Assert.isTrue(interval > 0, "interval should be greater than 0");
    Assert.hasLength(valueFormat, "valueFormat must not be empty");
    Assert.hasLength(labelFormat, "labelFormat must not be empty");

    LinkedHashMap<String, String> numbers = new LinkedHashMap<String, String>();
    if (from <= to) {
        for (int i = from; i <= to; i = i + interval) {
            putInMap(numbers, i);
        }
    } else {
        for (int i = from; i >= to; i = i - interval) {
            putInMap(numbers, i);
        }
    }
    map = Collections.unmodifiableMap(numbers);
}