Polishing

(cherry picked from commit b541fc9)
This commit is contained in:
Juergen Hoeller
2015-03-06 18:50:49 +01:00
parent f01a0303f1
commit 7ed7f981c9
14 changed files with 90 additions and 94 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -335,9 +335,10 @@ public abstract class CollectionUtils {
}
/**
* Adapt a {@code Map<K, List<V>>} to an {@code MultiValueMap<K,V>}.
* @param map the map
* Adapt a {@code Map<K, List<V>>} to an {@code MultiValueMap<K, V>}.
* @param map the original map
* @return the multi-value map
* @since 3.1
*/
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
return new MultiValueMapAdapter<K, V>(map);
@@ -348,8 +349,9 @@ public abstract class CollectionUtils {
* Return an unmodifiable view of the specified multi-value map.
* @param map the map for which an unmodifiable view is to be returned.
* @return an unmodifiable view of the specified multi-value map.
* @since 3.1
*/
public static <K,V> MultiValueMap<K,V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
public static <K, V> MultiValueMap<K, V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
Assert.notNull(map, "'map' must not be null");
Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
@@ -366,7 +368,7 @@ public abstract class CollectionUtils {
*/
private static class EnumerationIterator<E> implements Iterator<E> {
private Enumeration<E> enumeration;
private final Enumeration<E> enumeration;
public EnumerationIterator(Enumeration<E> enumeration) {
this.enumeration = enumeration;
@@ -476,8 +478,8 @@ public abstract class CollectionUtils {
}
@Override
public void putAll(Map<? extends K, ? extends List<V>> m) {
this.map.putAll(m);
public void putAll(Map<? extends K, ? extends List<V>> map) {
this.map.putAll(map);
}
@Override