diff --git a/src/main/java/org/apache/commons/collections/map/CompositeMap.java b/src/main/java/org/apache/commons/collections/map/CompositeMap.java index 357504199..d09864066 100644 --- a/src/main/java/org/apache/commons/collections/map/CompositeMap.java +++ b/src/main/java/org/apache/commons/collections/map/CompositeMap.java @@ -472,6 +472,7 @@ public class CompositeMap extends AbstractIterableMap implements Ser /** * Gets a hash code for the Map as per the Map specification. + * {@inheritDoc} */ @Override public int hashCode() { diff --git a/src/main/java/org/apache/commons/collections/map/DefaultedMap.java b/src/main/java/org/apache/commons/collections/map/DefaultedMap.java index bf5907c00..d9b62c8d4 100644 --- a/src/main/java/org/apache/commons/collections/map/DefaultedMap.java +++ b/src/main/java/org/apache/commons/collections/map/DefaultedMap.java @@ -75,6 +75,8 @@ public class DefaultedMap extends AbstractMapDecorator implements Se *

* The value specified is returned when a missing key is found. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @return a new defaulting map @@ -90,6 +92,8 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * The factory specified is called when a missing key is found. * The result will be returned as the result of the map get(key) method. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param factory the factory to use to create entries, must not be null * @return a new defaulting map @@ -109,6 +113,8 @@ public class DefaultedMap extends AbstractMapDecorator implements Se * The key is passed to the transformer as the input, and the result * will be returned as the result of the map get(key) method. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param transformer the transformer to use as a factory to create entries, must not be null * @return a new defaulting map diff --git a/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java b/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java index 3627af871..9b6d39001 100644 --- a/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java +++ b/src/main/java/org/apache/commons/collections/map/FixedSizeMap.java @@ -62,6 +62,8 @@ public class FixedSizeMap /** * Factory method to create a fixed size map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @return a new fixed size map * @throws IllegalArgumentException if map is null diff --git a/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java b/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java index cf6e24bf7..6adf92be9 100644 --- a/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java +++ b/src/main/java/org/apache/commons/collections/map/FixedSizeSortedMap.java @@ -64,6 +64,8 @@ public class FixedSizeSortedMap /** * Factory method to create a fixed size sorted map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @return a new fixed size sorted map * @throws IllegalArgumentException if map is null diff --git a/src/main/java/org/apache/commons/collections/map/LRUMap.java b/src/main/java/org/apache/commons/collections/map/LRUMap.java index 086de2c9f..65696554c 100644 --- a/src/main/java/org/apache/commons/collections/map/LRUMap.java +++ b/src/main/java/org/apache/commons/collections/map/LRUMap.java @@ -360,6 +360,7 @@ public class LRUMap * This is fixed in version 3.1 onwards. * * @param entry the entry to be removed + * @return {@code true} */ protected boolean removeLRU(LinkEntry entry) { return true; diff --git a/src/main/java/org/apache/commons/collections/map/LazyMap.java b/src/main/java/org/apache/commons/collections/map/LazyMap.java index 8bb2a1b7c..f575f8163 100644 --- a/src/main/java/org/apache/commons/collections/map/LazyMap.java +++ b/src/main/java/org/apache/commons/collections/map/LazyMap.java @@ -70,6 +70,8 @@ public class LazyMap extends AbstractMapDecorator implements Map the key type + * @param the value type * @param map the map to decorate, must not be null * @param factory the factory to use, must not be null * @return a new lazy map @@ -82,6 +84,8 @@ public class LazyMap extends AbstractMapDecorator implements Map the key type + * @param the value type * @param map the map to decorate, must not be null * @param factory the factory to use, must not be null * @return a new lazy map diff --git a/src/main/java/org/apache/commons/collections/map/LazySortedMap.java b/src/main/java/org/apache/commons/collections/map/LazySortedMap.java index c0f308c69..9f45dfd1a 100644 --- a/src/main/java/org/apache/commons/collections/map/LazySortedMap.java +++ b/src/main/java/org/apache/commons/collections/map/LazySortedMap.java @@ -66,8 +66,11 @@ public class LazySortedMap /** * Factory method to create a lazily instantiated sorted map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param factory the factory to use, must not be null + * @return a new lazy sorted map * @throws IllegalArgumentException if map or factory is null */ public static LazySortedMap lazySortedMap(SortedMap map, Factory factory) { @@ -77,8 +80,11 @@ public class LazySortedMap /** * Factory method to create a lazily instantiated sorted map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param factory the factory to use, must not be null + * @return a new lazy sorted map * @throws IllegalArgumentException if map or factory is null */ public static LazySortedMap lazySortedMap(SortedMap map, diff --git a/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java b/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java index 4d6facb6d..135644671 100644 --- a/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java +++ b/src/main/java/org/apache/commons/collections/map/ListOrderedMap.java @@ -89,7 +89,10 @@ public class ListOrderedMap *

* An ArrayList is used to retain order. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null + * @return a new list ordered map * @throws IllegalArgumentException if map is null */ public static ListOrderedMap listOrderedMap(Map map) { @@ -402,6 +405,7 @@ public class ListOrderedMap * Sets the value at the specified index. * * @param index the index of the value to set + * @param value the new value to set * @return the previous value at that index * @throws IndexOutOfBoundsException if the index is invalid * @since 3.2 diff --git a/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java b/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java index 98bb3fd2b..a512c8774 100644 --- a/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java +++ b/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java @@ -87,7 +87,10 @@ public class MultiKeyMap extends AbstractMapDecorator the key type + * @param the value type * @param map the map to decorate, not null + * @return a new multi key map * @throws IllegalArgumentException if the map is null or not empty */ public static MultiKeyMap multiKeyMap(AbstractHashedMap, V> map) { @@ -151,7 +154,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) { return true; @@ -259,7 +263,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) { return entry.getValue(); @@ -279,7 +284,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3)) { return true; @@ -374,7 +380,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry, Object key1, Object key2, Object key3) { + protected boolean isEqualKey(AbstractHashedMap.HashEntry, V> entry, + Object key1, Object key2, Object key3) { MultiKey multi = entry.getKey(); return multi.size() == 3 && @@ -395,7 +402,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) { return entry.getValue(); @@ -416,7 +424,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4)) { return true; @@ -518,7 +527,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry, Object key1, Object key2, Object key3, Object key4) { + protected boolean isEqualKey(AbstractHashedMap.HashEntry, V> entry, + Object key1, Object key2, Object key3, Object key4) { MultiKey multi = entry.getKey(); return multi.size() == 4 && @@ -541,7 +551,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) { return entry.getValue(); @@ -563,7 +574,8 @@ public class MultiKeyMap extends AbstractMapDecorator, V> entry = decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; + AbstractHashedMap.HashEntry, V> entry = + decorated().data[decorated().hashIndex(hashCode, decorated().data.length)]; while (entry != null) { if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2, key3, key4, key5)) { return true; diff --git a/src/main/java/org/apache/commons/collections/map/MultiValueMap.java b/src/main/java/org/apache/commons/collections/map/MultiValueMap.java index 1532cb14b..ffb7166ae 100644 --- a/src/main/java/org/apache/commons/collections/map/MultiValueMap.java +++ b/src/main/java/org/apache/commons/collections/map/MultiValueMap.java @@ -74,7 +74,10 @@ public class MultiValueMap extends AbstractMapDecorator impleme * Creates a map which wraps the given map and * maps keys to ArrayLists. * + * @param the key type + * @param the value type * @param map the map to wrap + * @return a new multi-value map */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static MultiValueMap multiValueMap(Map> map) { @@ -85,8 +88,11 @@ public class MultiValueMap extends AbstractMapDecorator impleme * Creates a map which decorates the given map and * maps keys to collections of type collectionClass. * + * @param the key type + * @param the value type * @param map the map to wrap * @param collectionClass the type of the collection class + * @return a new multi-value map */ public static > MultiValueMap multiValueMap(Map map, Class collectionClass) { @@ -97,8 +103,11 @@ public class MultiValueMap extends AbstractMapDecorator impleme * Creates a map which decorates the given map and * creates the value collections using the supplied collectionFactory. * + * @param the key type + * @param the value type * @param map the map to decorate * @param collectionFactory the collection factory (must return a Collection object). + * @return a new multi-value map */ public static > MultiValueMap multiValueMap(Map map, Factory collectionFactory) { diff --git a/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java b/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java index 0be932380..5aa2ca3a6 100644 --- a/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java +++ b/src/main/java/org/apache/commons/collections/map/PassiveExpiringMap.java @@ -339,6 +339,7 @@ public class PassiveExpiringMap /** * All expired entries are removed from the map prior to determining the * contains result. + * {@inheritDoc} */ @Override public boolean containsKey(Object key) { @@ -349,6 +350,7 @@ public class PassiveExpiringMap /** * All expired entries are removed from the map prior to determining the * contains result. + * {@inheritDoc} */ @Override public boolean containsValue(Object value) { @@ -357,8 +359,8 @@ public class PassiveExpiringMap } /** - * All expired entries are removed from the map prior to returning the entry - * set. + * All expired entries are removed from the map prior to returning the entry set. + * {@inheritDoc} */ @Override public Set> entrySet() { @@ -367,8 +369,8 @@ public class PassiveExpiringMap } /** - * All expired entries are removed from the map prior to returning the entry - * value. + * All expired entries are removed from the map prior to returning the entry value. + * {@inheritDoc} */ @Override public V get(Object key) { @@ -377,8 +379,8 @@ public class PassiveExpiringMap } /** - * All expired entries are removed from the map prior to determining if it - * is empty. + * All expired entries are removed from the map prior to determining if it is empty. + * {@inheritDoc} */ @Override public boolean isEmpty() { @@ -387,7 +389,7 @@ public class PassiveExpiringMap } /** - * Determines if the given expiration time is less than now + * Determines if the given expiration time is less than now. * * @param now the time in milliseconds used to compare against the * expiration time. @@ -406,8 +408,8 @@ public class PassiveExpiringMap } /** - * All expired entries are removed from the map prior to returning the key - * set. + * All expired entries are removed from the map prior to returning the key set. + * {@inheritDoc} */ @Override public Set keySet() { @@ -428,9 +430,8 @@ public class PassiveExpiringMap } /** - * Add the given key-value pair to this map as well as recording the entry's - * expiration time based on the current time in milliseconds, - * now and this map's {@link #expiringPolicy}. + * Add the given key-value pair to this map as well as recording the entry's expiration time based on + * the current time in milliseconds, now and this map's {@link #expiringPolicy}. */ private V put(K key, V value, long now) { // record expiration time of new entry @@ -450,6 +451,7 @@ public class PassiveExpiringMap /** * Normal {@link Map#remove(Object)} behavior with the addition of removing * any expiration entry as well. + * {@inheritDoc} */ @Override public V remove(Object key) { @@ -492,6 +494,7 @@ public class PassiveExpiringMap /** * All expired entries are removed from the map prior to returning the size. + * {@inheritDoc} */ @Override public int size() { @@ -527,8 +530,8 @@ public class PassiveExpiringMap } /** - * All expired entries are removed from the map prior to returning the value - * collection. + * All expired entries are removed from the map prior to returning the value collection. + * {@inheritDoc} */ @Override public Collection values() { diff --git a/src/main/java/org/apache/commons/collections/map/PredicatedMap.java b/src/main/java/org/apache/commons/collections/map/PredicatedMap.java index 21f5d3924..0554eabe1 100644 --- a/src/main/java/org/apache/commons/collections/map/PredicatedMap.java +++ b/src/main/java/org/apache/commons/collections/map/PredicatedMap.java @@ -66,9 +66,12 @@ public class PredicatedMap * If there are any elements already in the list being decorated, they * are validated. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param keyPredicate the predicate to validate the keys, null means no check * @param valuePredicate the predicate to validate to values, null means no check + * @return a new predicated map * @throws IllegalArgumentException if the map is null */ public static PredicatedMap predicatedMap(Map map, @@ -146,6 +149,7 @@ public class PredicatedMap * Override to validate an object set into the map via setValue. * * @param value the value to validate + * @return the value itself * @throws IllegalArgumentException if invalid * @since 3.1 */ diff --git a/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java b/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java index 17242d2af..519545fcf 100644 --- a/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java +++ b/src/main/java/org/apache/commons/collections/map/PredicatedSortedMap.java @@ -54,9 +54,12 @@ public class PredicatedSortedMap extends PredicatedMap implements So * If there are any elements already in the list being decorated, they * are validated. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param keyPredicate the predicate to validate the keys, null means no check * @param valuePredicate the predicate to validate to values, null means no check + * @return a new predicated sorted map * @throws IllegalArgumentException if the map is null */ public static PredicatedSortedMap predicatedSortedMap(SortedMap map, diff --git a/src/main/java/org/apache/commons/collections/map/TransformedMap.java b/src/main/java/org/apache/commons/collections/map/TransformedMap.java index d63ed3d2f..a61310769 100644 --- a/src/main/java/org/apache/commons/collections/map/TransformedMap.java +++ b/src/main/java/org/apache/commons/collections/map/TransformedMap.java @@ -64,9 +64,12 @@ public class TransformedMap * are NOT transformed. * Contrast this with {@link #transformedMap(Map, Transformer, Transformer)}. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param keyTransformer the transformer to use for key conversion, null means no transformation * @param valueTransformer the transformer to use for value conversion, null means no transformation + * @return a new transformed map * @throws IllegalArgumentException if map is null */ public static TransformedMap transformingMap(Map map, @@ -83,9 +86,12 @@ public class TransformedMap * will be transformed by this method. * Contrast this with {@link #transformingMap(Map, Transformer, Transformer)}. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param keyTransformer the transformer to use for key conversion, null means no transformation * @param valueTransformer the transformer to use for value conversion, null means no transformation + * @return a new transformed map * @throws IllegalArgumentException if map is null * @since 3.2 */ @@ -154,7 +160,7 @@ public class TransformedMap * The transformer itself may throw an exception if necessary. * * @param object the object to transform - * @throws the transformed object + * @return the transformed object */ protected K transformKey(K object) { if (keyTransformer == null) { @@ -169,7 +175,7 @@ public class TransformedMap * The transformer itself may throw an exception if necessary. * * @param object the object to transform - * @throws the transformed object + * @return the transformed object */ protected V transformValue(V object) { if (valueTransformer == null) { @@ -184,7 +190,7 @@ public class TransformedMap * The transformer itself may throw an exception if necessary. * * @param map the map to transform - * @throws the transformed object + * @return the transformed object */ @SuppressWarnings("unchecked") protected Map transformMap(Map map) { diff --git a/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java b/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java index ac533e828..8ccbe2bef 100644 --- a/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java +++ b/src/main/java/org/apache/commons/collections/map/TransformedSortedMap.java @@ -51,13 +51,15 @@ public class TransformedSortedMap /** * Factory method to create a transforming sorted map. *

- * If there are any elements already in the map being decorated, they - * are NOT transformed. + * If there are any elements already in the map being decorated, they are NOT transformed. * Contrast this with {@link #transformedSortedMap(SortedMap, Transformer, Transformer)}. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param keyTransformer the predicate to validate the keys, null means no transformation * @param valueTransformer the predicate to validate to values, null means no transformation + * @return a new transformed sorted map * @throws IllegalArgumentException if the map is null */ public static TransformedSortedMap transformingSortedMap(SortedMap map, @@ -74,9 +76,12 @@ public class TransformedSortedMap * will be transformed by this method. * Contrast this with {@link #transformingSortedMap(SortedMap, Transformer, Transformer)}. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null * @param keyTransformer the transformer to use for key conversion, null means no transformation * @param valueTransformer the transformer to use for value conversion, null means no transformation + * @return a new transformed sorted map * @throws IllegalArgumentException if map is null * @since 3.2 */ diff --git a/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java b/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java index 9f3b1804c..d190a17a3 100644 --- a/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java +++ b/src/main/java/org/apache/commons/collections/map/UnmodifiableEntrySet.java @@ -44,7 +44,10 @@ public final class UnmodifiableEntrySet /** * Factory method to create an unmodifiable set of Map Entry objects. * + * @param the key type + * @param the value type * @param set the set to decorate, must not be null + * @return a new unmodifiable entry set * @throws IllegalArgumentException if set is null */ public static Set> unmodifiableEntrySet(Set> set) { diff --git a/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java b/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java index 97a0e0cdb..06c796756 100644 --- a/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java +++ b/src/main/java/org/apache/commons/collections/map/UnmodifiableMap.java @@ -52,7 +52,10 @@ public final class UnmodifiableMap /** * Factory method to create an unmodifiable map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null + * @return a new unmodifiable map * @throws IllegalArgumentException if map is null */ public static Map unmodifiableMap(Map map) { diff --git a/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java b/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java index 46a3c790e..d28bae480 100644 --- a/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java +++ b/src/main/java/org/apache/commons/collections/map/UnmodifiableOrderedMap.java @@ -50,7 +50,10 @@ public final class UnmodifiableOrderedMap extends AbstractOrderedMapDecora /** * Factory method to create an unmodifiable sorted map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null + * @return a new ordered map * @throws IllegalArgumentException if map is null */ public static OrderedMap unmodifiableOrderedMap(OrderedMap map) { diff --git a/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java b/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java index 603612339..04344e79e 100644 --- a/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java +++ b/src/main/java/org/apache/commons/collections/map/UnmodifiableSortedMap.java @@ -50,7 +50,10 @@ public final class UnmodifiableSortedMap /** * Factory method to create an unmodifiable sorted map. * + * @param the key type + * @param the value type * @param map the map to decorate, must not be null + * @return a new unmodifiable sorted map * @throws IllegalArgumentException if map is null */ public static SortedMap unmodifiableSortedMap(SortedMap map) {