Polishing

This commit is contained in:
Juergen Hoeller
2015-07-07 02:10:21 +02:00
parent ca9beeac9d
commit 7c72a57a4d
4 changed files with 52 additions and 34 deletions

View File

@@ -342,7 +342,6 @@ public abstract class CollectionUtils {
*/
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
return new MultiValueMapAdapter<K, V>(map);
}
/**
@@ -390,6 +389,7 @@ public abstract class CollectionUtils {
}
}
/**
* Adapts a Map to the MultiValueMap contract.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -59,8 +59,9 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
}
/**
* Copy constructor: Create a new LinkedMultiValueMap with the same mappings
* as the specified Map.
* Copy constructor: Create a new LinkedMultiValueMap with the same mappings as
* the specified Map. Note that this will be a shallow copy; its value-holding
* List entries will get reused and therefore cannot get modified independently.
* @param otherMap the Map whose mappings are to be placed in this Map
*/
public LinkedMultiValueMap(Map<K, List<V>> otherMap) {
@@ -103,7 +104,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
@Override
public Map<K, V> toSingleValueMap() {
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<K,V>(this.targetMap.size());
for (Entry<K, List<V>> entry : targetMap.entrySet()) {
for (Entry<K, List<V>> entry : this.targetMap.entrySet()) {
singleValueMap.put(entry.getKey(), entry.getValue().get(0));
}
return singleValueMap;
@@ -148,8 +149,8 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
}
@Override
public void putAll(Map<? extends K, ? extends List<V>> m) {
this.targetMap.putAll(m);
public void putAll(Map<? extends K, ? extends List<V>> map) {
this.targetMap.putAll(map);
}
@Override