本文整理了Java中org.apache.commons.collections.MultiMap.putAll()
方法的一些代码示例,展示了MultiMap.putAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.putAll()
方法的具体详情如下:
包路径:org.apache.commons.collections.MultiMap
类名称:MultiMap
方法名:putAll
暂无
代码示例来源:origin: jadler-mocking/jadler
/**
* Adds headers to this stub response. If there already exists a header with a same name
* in this stub response, multiple values will be sent.
* @param headers response headers (both keys and values must be of type String)
*/
@SuppressWarnings("unchecked")
void addHeaders(final MultiMap headers) {
this.headers.putAll(headers);
}
代码示例来源:origin: net.jadler/jadler-core
/**
* Adds headers to this stub response. If there already exists a header with a same name
* in this stub response, multiple values will be sent.
* @param headers response headers (both keys and values must be of type String)
*/
@SuppressWarnings("unchecked")
void addHeaders(final MultiMap headers) {
this.headers.putAll(headers);
}
代码示例来源:origin: org.jsmiparser/jsmiparser-util
public void putAllMultiMap(Map<? extends K, ? extends Collection<V>> t) {
m_impl.putAll(t);
}
代码示例来源:origin: net.jadler/jadler-core
/**
* Adds all values from the given instance. Supports multi-values for one key (if there has already been added
* some value with this key, additional value is added instead of rewriting). Please note this method
* creates new instance containing all existing values plus the new ones rather than modifying this instance.
* @param keyValues values to be added no(cannot be {@code null})
* @return an exact copy of this instance containing all existing values plus the new ones
*/
@SuppressWarnings("unchecked")
public KeyValues addAll(final KeyValues keyValues) {
Validate.notNull(keyValues, "keyValues cannot be null");
final KeyValues res = new KeyValues();
res.values.putAll(this.values);
res.values.putAll(keyValues.values);
return res;
}
代码示例来源:origin: jadler-mocking/jadler
/**
* Adds all values from the given instance. Supports multi-values for one key (if there has already been added
* some value with this key, additional value is added instead of rewriting). Please note this method
* creates new instance containing all existing values plus the new ones rather than modifying this instance.
* @param keyValues values to be added no(cannot be {@code null})
* @return an exact copy of this instance containing all existing values plus the new ones
*/
@SuppressWarnings("unchecked")
public KeyValues addAll(final KeyValues keyValues) {
Validate.notNull(keyValues, "keyValues cannot be null");
final KeyValues res = new KeyValues();
res.values.putAll(this.values);
res.values.putAll(keyValues.values);
return res;
}
代码示例来源:origin: org.apache.cocoon/cocoon-expression-language-impl
public void setParent(ObjectModel parentObjectModel) {
if (this.modified) {
throw new IllegalStateException("Setting parent may occur only if Object Model is empty.");
}
singleValueMap.putAll(parentObjectModel);
multiValueMap.putAll(parentObjectModel.getAll());
}
}
代码示例来源:origin: net.jadler/jadler-core
/**
* @param defaultHeaders default headers to be present in every http stub response
* @param defaultStatus default http status of every http stub response
* (can be overridden in the particular stub)
* @param defaultEncoding default encoding of every stub response body (can be overridden in the particular stub)
*/
@SuppressWarnings("unchecked")
Stubbing(final Charset defaultEncoding, final int defaultStatus, final MultiMap defaultHeaders) {
this.stubResponses = new ArrayList<MutableStubResponse>();
this.defaultHeaders = new MultiValueMap();
this.defaultHeaders.putAll(defaultHeaders);
this.defaultStatus = defaultStatus;
this.defaultEncoding = defaultEncoding;
this.responder = null;
}
代码示例来源:origin: jadler-mocking/jadler
/**
* @param defaultHeaders default headers to be present in every http stub response
* @param defaultStatus default http status of every http stub response
* (can be overridden in the particular stub)
* @param defaultEncoding default encoding of every stub response body (can be overridden in the particular stub)
*/
@SuppressWarnings("unchecked")
Stubbing(final Charset defaultEncoding, final int defaultStatus, final MultiMap defaultHeaders) {
this.stubResponses = new ArrayList<MutableStubResponse>();
this.defaultHeaders = new MultiValueMap();
this.defaultHeaders.putAll(defaultHeaders);
this.defaultStatus = defaultStatus;
this.defaultEncoding = defaultEncoding;
this.responder = null;
}
代码示例来源:origin: org.apache.cocoon/cocoon-expression-language-impl
public void putAll(Map mapToCopy) {
modified = true;
if (!localContexts.empty()) {
ArrayStack entries = (ArrayStack)localContexts.peek();
for (Iterator keysIterator = mapToCopy.keySet().iterator(); keysIterator.hasNext();) {
Object key = keysIterator.next();
entries.push(new DefaultKeyValue(key, mapToCopy.get(key)));
}
}
singleValueMap.putAll(mapToCopy);
multiValueMap.putAll(mapToCopy);
}
代码示例来源:origin: jadler-mocking/jadler
/**
* Adds new key-value pair. Supports multi-values for one key (if there has already been added
* some value with this key, additional value is added instead of rewriting). Please note this method
* creates new instance containing all existing values plus the new one rather than modifying this instance.
* @param key key (cannot be empty)
* @param value value (cannot be {@code null}, however can be empty for valueless headers)
* @return an exact copy of this instance containing all existing values plus the new one
*/
@SuppressWarnings("unchecked")
public KeyValues add(final String key, final String value) {
Validate.notEmpty(key, "key cannot be empty");
Validate.notNull(value, "value cannot be null, use an empty string instead");
final KeyValues res = new KeyValues();
res.values.putAll(this.values);
res.values.put(key.toLowerCase(), value);
return res;
}
代码示例来源:origin: net.jadler/jadler-core
/**
* Adds new key-value pair. Supports multi-values for one key (if there has already been added
* some value with this key, additional value is added instead of rewriting). Please note this method
* creates new instance containing all existing values plus the new one rather than modifying this instance.
* @param key key (cannot be empty)
* @param value value (cannot be {@code null}, however can be empty for valueless headers)
* @return an exact copy of this instance containing all existing values plus the new one
*/
@SuppressWarnings("unchecked")
public KeyValues add(final String key, final String value) {
Validate.notEmpty(key, "key cannot be empty");
Validate.notNull(value, "value cannot be null, use an empty string instead");
final KeyValues res = new KeyValues();
res.values.putAll(this.values);
res.values.put(key.toLowerCase(), value);
return res;
}
代码示例来源:origin: net.jadler/jadler-core
/**
* Removes all occurrences of the given header in this stub response (using a case insensitive search)
* and sets its single value.
* @param name header name
* @param value header value
*/
@SuppressWarnings("unchecked")
void setHeaderCaseInsensitive(final String name, final String value) {
final MultiMap result = new MultiValueMap();
for (final Object o: this.headers.keySet()) {
final String key = (String) o; //fucking non-generics MultiMap
if (!name.equalsIgnoreCase(key)) {
//copy all other headers to the result multimap
for(final String s: (Collection<String>)this.headers.get(o)) {
result.put(o, s);
}
}
}
this.headers.clear();
this.headers.putAll(result);
this.addHeader(name, value);
}
代码示例来源:origin: jadler-mocking/jadler
/**
* Removes all occurrences of the given header in this stub response (using a case insensitive search)
* and sets its single value.
* @param name header name
* @param value header value
*/
@SuppressWarnings("unchecked")
void setHeaderCaseInsensitive(final String name, final String value) {
final MultiMap result = new MultiValueMap();
for (final Object o: this.headers.keySet()) {
final String key = (String) o; //fucking non-generics MultiMap
if (!name.equalsIgnoreCase(key)) {
//copy all other headers to the result multimap
for(final String s: (Collection<String>)this.headers.get(o)) {
result.put(o, s);
}
}
}
this.headers.clear();
this.headers.putAll(result);
this.addHeader(name, value);
}
内容来源于网络,如有侵权,请联系作者删除!