Fix formatting, warnings.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1633227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f453d6d13f
commit
ef70e7408f
|
@ -18,7 +18,6 @@ package org.apache.commons.collections4;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -150,7 +149,7 @@ public class MultiMapUtils {
|
|||
*/
|
||||
public static <K, V> Set<V> getSet(MultiValuedMap<K, V> map, K key) {
|
||||
if (map != null) {
|
||||
Collection<V> col = map.get(key);
|
||||
Collection<V> col = map.get(key);
|
||||
if (col instanceof Set) {
|
||||
return (Set<V>) col;
|
||||
}
|
||||
|
@ -184,7 +183,7 @@ public class MultiMapUtils {
|
|||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Creates a {@link ListValuedMap} with a {@link HashMap} as its internal storage.
|
||||
* Creates a {@link ListValuedMap} with a {@link java.util.HashMap HashMap} as its internal storage.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
|
@ -195,7 +194,7 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link ListValuedMap} with a {@link HashMap} as its internal
|
||||
* Creates a {@link ListValuedMap} with a {@link java.util.HashMap HashMap} as its internal
|
||||
* storage which maps the keys to list of type <code>listClass</code>.
|
||||
*
|
||||
* @param <K> the key type
|
||||
|
@ -209,7 +208,7 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link SetValuedMap} with a {@link HashMap} as its internal
|
||||
* Creates a {@link SetValuedMap} with a {@link java.util.HashMap HashMap} as its internal
|
||||
* storage
|
||||
*
|
||||
* @param <K> the key type
|
||||
|
@ -221,7 +220,7 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link SetValuedMap} with a {@link HashMap} as its internal
|
||||
* Creates a {@link SetValuedMap} with a {@link java.util.HashMap HashMap} as its internal
|
||||
* storage which maps the keys to a set of type <code>setClass</code>
|
||||
*
|
||||
* @param <K> the key type
|
||||
|
|
|
@ -16,16 +16,22 @@
|
|||
*/
|
||||
package org.apache.commons.collections4.multimap;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections4.ListValuedMap;
|
||||
import org.apache.commons.collections4.MultiValuedMap;
|
||||
import org.apache.commons.collections4.SetValuedMap;
|
||||
|
||||
/**
|
||||
* Implements a {@link MultiValuedMap}, using a {@link LinkedHashMap} to provide data
|
||||
* storage. This MultiValuedMap implementation the allows insertion order to be
|
||||
* maintained.
|
||||
* Implements a {@link MultiValuedMap}, using a {@link LinkedHashMap} to provide
|
||||
* data storage. This MultiValuedMap implementation the allows insertion order
|
||||
* to be maintained.
|
||||
* <p>
|
||||
* A <code>MultiValuedMap</code> is a Map with slightly different semantics.
|
||||
* Putting a value into the map will add the value to a Collection at that key.
|
||||
|
@ -43,7 +49,7 @@ import org.apache.commons.collections4.SetValuedMap;
|
|||
* exceptions when accessed by concurrent threads without synchronization.
|
||||
*
|
||||
* @since 4.1
|
||||
* @version $Id$
|
||||
* @version $Id: $
|
||||
*/
|
||||
public class MultiValuedLinkedHashMap<K, V> extends AbstractMultiValuedMap<K, V> implements MultiValuedMap<K, V> {
|
||||
|
||||
|
@ -221,7 +227,8 @@ public class MultiValuedLinkedHashMap<K, V> extends AbstractMultiValuedMap<K, V>
|
|||
*/
|
||||
protected <C extends Collection<V>> MultiValuedLinkedHashMap(int initialCapacity, float loadFactor,
|
||||
final Class<C> collectionClazz, int initialCollectionCapacity) {
|
||||
super(new LinkedHashMap<K, Collection<V>>(initialCapacity, loadFactor), collectionClazz, initialCollectionCapacity);
|
||||
super(new LinkedHashMap<K, Collection<V>>(initialCapacity, loadFactor), collectionClazz,
|
||||
initialCollectionCapacity);
|
||||
}
|
||||
|
||||
/** Inner class for ListValuedLinkedMap */
|
||||
|
|
|
@ -16,17 +16,25 @@
|
|||
*/
|
||||
package org.apache.commons.collections4.multimap;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
||||
import org.apache.commons.collections4.*;
|
||||
import org.apache.commons.collections4.BulkTest;
|
||||
import org.apache.commons.collections4.ListValuedMap;
|
||||
import org.apache.commons.collections4.MapIterator;
|
||||
import org.apache.commons.collections4.MultiValuedMap;
|
||||
import org.apache.commons.collections4.SetValuedMap;
|
||||
|
||||
/**
|
||||
* Test MultiValuedLinkedHashMap
|
||||
*
|
||||
* @since 4.1
|
||||
* @version $Id$
|
||||
* @version $Id: $
|
||||
*/
|
||||
public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
|
||||
|
||||
|
@ -47,8 +55,8 @@ public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTe
|
|||
public void testIterationOrder() {
|
||||
MultiValuedMap<K, V> map = makeFullMap();
|
||||
MapIterator<K, V> mapIt = map.mapIterator();
|
||||
Iterator keyIt = Arrays.asList(getSampleKeys()).iterator();
|
||||
Iterator valueIt = Arrays.asList(getSampleValues()).iterator();
|
||||
Iterator<K> keyIt = Arrays.asList(getSampleKeys()).iterator();
|
||||
Iterator<V> valueIt = Arrays.asList(getSampleValues()).iterator();
|
||||
|
||||
while(mapIt.hasNext()) {
|
||||
mapIt.next();
|
||||
|
@ -114,8 +122,8 @@ public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTe
|
|||
addSampleMappings(setMap);
|
||||
|
||||
MapIterator<K, V> mapIt = setMap.mapIterator();
|
||||
Iterator keyIt = Arrays.asList(getSampleKeys()).iterator();
|
||||
Iterator valueIt = Arrays.asList(getSampleValues()).iterator();
|
||||
Iterator<K> keyIt = Arrays.asList(getSampleKeys()).iterator();
|
||||
Iterator<V> valueIt = Arrays.asList(getSampleValues()).iterator();
|
||||
|
||||
while(mapIt.hasNext()) {
|
||||
mapIt.next();
|
||||
|
@ -190,8 +198,8 @@ public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTe
|
|||
addSampleMappings(listMap);
|
||||
|
||||
MapIterator<K, V> mapIt = listMap.mapIterator();
|
||||
Iterator keyIt = Arrays.asList(getSampleKeys()).iterator();
|
||||
Iterator valueIt = Arrays.asList(getSampleValues()).iterator();
|
||||
Iterator<K> keyIt = Arrays.asList(getSampleKeys()).iterator();
|
||||
Iterator<V> valueIt = Arrays.asList(getSampleValues()).iterator();
|
||||
|
||||
while(mapIt.hasNext()) {
|
||||
mapIt.next();
|
||||
|
|
Loading…
Reference in New Issue