Example usage for org.springframework.util LinkedCaseInsensitiveMap LinkedCaseInsensitiveMap

List of usage examples for org.springframework.util LinkedCaseInsensitiveMap LinkedCaseInsensitiveMap

Introduction

In this page you can find the example usage for org.springframework.util LinkedCaseInsensitiveMap LinkedCaseInsensitiveMap.

Prototype

public LinkedCaseInsensitiveMap(int initialCapacity, @Nullable Locale locale) 

Source Link

Document

Create a new LinkedCaseInsensitiveMap that wraps a LinkedHashMap with the given initial capacity and stores case-insensitive keys according to the given Locale (by default in lower case).

Usage

From source file:jails.http.HttpHeaders.java

/**
 * Private constructor that can create read-only {@code HttpHeader} instances.
 *///from   w w  w  . j  a v a  2  s. c  o  m
private HttpHeaders(Map<String, List<String>> headers, boolean readOnly) {
    Assert.notNull(headers, "'headers' must not be null");
    if (readOnly) {
        Map<String, List<String>> map = new LinkedCaseInsensitiveMap<List<String>>(headers.size(),
                Locale.ENGLISH);
        for (Entry<String, List<String>> entry : headers.entrySet()) {
            List<String> values = Collections.unmodifiableList(entry.getValue());
            map.put(entry.getKey(), values);
        }
        this.headers = Collections.unmodifiableMap(map);
    } else {
        this.headers = headers;
    }
}

From source file:jails.http.HttpHeaders.java

/**
 * Constructs a new, empty instance of the {@code HttpHeaders} object.
 *///ww  w  . java  2 s.c o  m
public HttpHeaders() {
    this(new LinkedCaseInsensitiveMap<List<String>>(8, Locale.ENGLISH), false);
}

From source file:jails.http.MediaType.java

/**
 * Create a new {@link MediaType} for the given type, subtype, and parameters.
 * @param type the primary type/*from  w  w w  . ja v  a2  s . c  o  m*/
 * @param subtype the subtype
 * @param parameters the parameters, may be <code>null</code>
 * @throws IllegalArgumentException if any of the parameters contain illegal characters
 */
public MediaType(String type, String subtype, Map<String, String> parameters) {
    Assert.hasLength(type, "'type' must not be empty");
    Assert.hasLength(subtype, "'subtype' must not be empty");
    checkToken(type);
    checkToken(subtype);
    this.type = type.toLowerCase(Locale.ENGLISH);
    this.subtype = subtype.toLowerCase(Locale.ENGLISH);
    if (!CollectionUtils.isEmpty(parameters)) {
        Map<String, String> m = new LinkedCaseInsensitiveMap<String>(parameters.size(), Locale.ENGLISH);
        for (Map.Entry<String, String> entry : parameters.entrySet()) {
            String attribute = entry.getKey();
            String value = entry.getValue();
            checkParameters(attribute, value);
            m.put(attribute, unquote(value));
        }
        this.parameters = Collections.unmodifiableMap(m);
    } else {
        this.parameters = Collections.emptyMap();
    }
}