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:
Thomas Neidhart 2014-10-20 21:00:58 +00:00
parent f453d6d13f
commit ef70e7408f
3 changed files with 35 additions and 21 deletions

View File

@ -18,7 +18,6 @@ package org.apache.commons.collections4;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -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 <K> the key type
* @param <V> the value 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>. * storage which maps the keys to list of type <code>listClass</code>.
* *
* @param <K> the key type * @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 * storage
* *
* @param <K> the key type * @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> * storage which maps the keys to a set of type <code>setClass</code>
* *
* @param <K> the key type * @param <K> the key type

View File

@ -16,16 +16,22 @@
*/ */
package org.apache.commons.collections4.multimap; 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.ListValuedMap;
import org.apache.commons.collections4.MultiValuedMap; import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.SetValuedMap; import org.apache.commons.collections4.SetValuedMap;
/** /**
* Implements a {@link MultiValuedMap}, using a {@link LinkedHashMap} to provide data * Implements a {@link MultiValuedMap}, using a {@link LinkedHashMap} to provide
* storage. This MultiValuedMap implementation the allows insertion order to be * data storage. This MultiValuedMap implementation the allows insertion order
* maintained. * to be maintained.
* <p> * <p>
* A <code>MultiValuedMap</code> is a Map with slightly different semantics. * 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. * 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. * exceptions when accessed by concurrent threads without synchronization.
* *
* @since 4.1 * @since 4.1
* @version $Id$ * @version $Id: $
*/ */
public class MultiValuedLinkedHashMap<K, V> extends AbstractMultiValuedMap<K, V> implements MultiValuedMap<K, V> { 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, protected <C extends Collection<V>> MultiValuedLinkedHashMap(int initialCapacity, float loadFactor,
final Class<C> collectionClazz, int initialCollectionCapacity) { 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 */ /** Inner class for ListValuedLinkedMap */

View File

@ -16,17 +16,25 @@
*/ */
package org.apache.commons.collections4.multimap; 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 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 * Test MultiValuedLinkedHashMap
* *
* @since 4.1 * @since 4.1
* @version $Id$ * @version $Id: $
*/ */
public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> { public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> {
@ -47,8 +55,8 @@ public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTe
public void testIterationOrder() { public void testIterationOrder() {
MultiValuedMap<K, V> map = makeFullMap(); MultiValuedMap<K, V> map = makeFullMap();
MapIterator<K, V> mapIt = map.mapIterator(); MapIterator<K, V> mapIt = map.mapIterator();
Iterator keyIt = Arrays.asList(getSampleKeys()).iterator(); Iterator<K> keyIt = Arrays.asList(getSampleKeys()).iterator();
Iterator valueIt = Arrays.asList(getSampleValues()).iterator(); Iterator<V> valueIt = Arrays.asList(getSampleValues()).iterator();
while(mapIt.hasNext()) { while(mapIt.hasNext()) {
mapIt.next(); mapIt.next();
@ -114,8 +122,8 @@ public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTe
addSampleMappings(setMap); addSampleMappings(setMap);
MapIterator<K, V> mapIt = setMap.mapIterator(); MapIterator<K, V> mapIt = setMap.mapIterator();
Iterator keyIt = Arrays.asList(getSampleKeys()).iterator(); Iterator<K> keyIt = Arrays.asList(getSampleKeys()).iterator();
Iterator valueIt = Arrays.asList(getSampleValues()).iterator(); Iterator<V> valueIt = Arrays.asList(getSampleValues()).iterator();
while(mapIt.hasNext()) { while(mapIt.hasNext()) {
mapIt.next(); mapIt.next();
@ -190,8 +198,8 @@ public class MultiValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedMapTe
addSampleMappings(listMap); addSampleMappings(listMap);
MapIterator<K, V> mapIt = listMap.mapIterator(); MapIterator<K, V> mapIt = listMap.mapIterator();
Iterator keyIt = Arrays.asList(getSampleKeys()).iterator(); Iterator<K> keyIt = Arrays.asList(getSampleKeys()).iterator();
Iterator valueIt = Arrays.asList(getSampleValues()).iterator(); Iterator<V> valueIt = Arrays.asList(getSampleValues()).iterator();
while(mapIt.hasNext()) { while(mapIt.hasNext()) {
mapIt.next(); mapIt.next();