Remove trailing spaces.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1477799 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-04-30 19:56:11 +00:00
parent b7a0c8d3de
commit 810250d722
33 changed files with 325 additions and 325 deletions

View File

@ -135,13 +135,13 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
* @throws IllegalArgumentException if the initial capacity is negative
* @throws IllegalArgumentException if the load factor is less than or equal to zero
* @throws IllegalArgumentException if the load factor is less than or equal to zero
*/
@SuppressWarnings("unchecked")
protected AbstractHashedMap(int initialCapacity, final float loadFactor) {
super();
if (initialCapacity < 0) {
throw new IllegalArgumentException("Initial capacity must be a non negative number");
throw new IllegalArgumentException("Initial capacity must be a non negative number");
}
if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) {
throw new IllegalArgumentException("Load factor must be greater than 0");
@ -311,9 +311,9 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
* This implementation iterates around the specified map and
* uses {@link #put(Object, Object)}.
* <p>
* It is private to allow the constructor to still call it
* even when putAll is overriden.
*
* It is private to allow the constructor to still call it
* even when putAll is overriden.
*
* @param map the map to add
* @throws NullPointerException if the map is null
*/

View File

@ -54,7 +54,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
@ -70,7 +70,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
* or it may transform the value into another object.
* <p>
* This implementation returns the input value.
*
*
* @param value the value to check
* @throws UnsupportedOperationException if the map may not be changed by setValue
* @throws IllegalArgumentException if the specified value is invalid
@ -86,7 +86,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
* has no effect as this optimises the implementation.
* <p>
* This implementation returns <code>true</code>.
*
*
* @return true always
*/
protected boolean isSetValueChecking() {
@ -107,7 +107,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
* Implementation of an entry set that checks additions via setValue.
*/
private class EntrySet extends AbstractSetDecorator<Map.Entry<K, V>> {
/** Generated serial version ID. */
private static final long serialVersionUID = 4354731610923110264L;
@ -123,7 +123,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
public Iterator<Map.Entry<K, V>> iterator() {
return new EntrySetIterator(collection.iterator(), parent);
}
@Override
@SuppressWarnings("unchecked")
public Object[] toArray() {
@ -133,7 +133,7 @@ abstract class AbstractInputCheckedMapDecorator<K, V>
}
return array;
}
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(final T[] array) {

View File

@ -60,7 +60,7 @@ import org.apache.commons.collections4.iterators.EmptyOrderedMapIterator;
* @version $Id$
*/
public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> implements OrderedMap<K, V> {
/** Header in the linked list */
protected transient LinkEntry<K, V> header; // TODO Privatise?
@ -73,7 +73,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Constructor which performs no validation on the passed in parameters.
*
*
* @param initialCapacity the initial capacity, must be a power of two
* @param loadFactor the load factor, must be > 0.0f and generally < 1.0f
* @param threshold the threshold, must be sensible
@ -83,7 +83,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
}
/**
* Constructs a new, empty map with the specified initial capacity.
* Constructs a new, empty map with the specified initial capacity.
*
* @param initialCapacity the initial capacity
* @throws IllegalArgumentException if the initial capacity is negative
@ -94,7 +94,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Constructs a new, empty map with the specified initial capacity and
* load factor.
* load factor.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
@ -131,7 +131,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
//-----------------------------------------------------------------------
/**
* Checks whether the map contains the specified value.
*
*
* @param value the value to search for
* @return true if the map contains the value
*/
@ -168,7 +168,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
//-----------------------------------------------------------------------
/**
* Gets the first key in the map, which is the first inserted.
*
*
* @return the eldest key
*/
public K firstKey() {
@ -180,7 +180,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Gets the last key in the map, which is the most recently inserted.
*
*
* @return the most recently inserted key
*/
public K lastKey() {
@ -192,7 +192,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Gets the next key in sequence.
*
*
* @param key the key to get after
* @return the next key
*/
@ -208,7 +208,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Gets the previous key in sequence.
*
*
* @param key the key to get before
* @return the previous key
*/
@ -217,10 +217,10 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
return entry == null || entry.before == header ? null : entry.before.getKey();
}
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
/**
* Gets the key at the specified index.
*
*
* @param index the index to retrieve
* @return the key at the specified index
* @throws IndexOutOfBoundsException if the index is invalid
@ -248,13 +248,13 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
}
return entry;
}
/**
* Adds an entry into this map, maintaining insertion order.
* <p>
* This implementation adds the entry to the data storage table and
* to the end of the linked list.
*
*
* @param entry the entry to add
* @param hashIndex the index into the data array to store at
*/
@ -272,7 +272,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
* Creates an entry to store the data.
* <p>
* This implementation creates a new LinkEntry instance.
*
*
* @param next the next entry in sequence
* @param hashCode the hash code to use
* @param key the key to store
@ -289,7 +289,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
* <p>
* This implementation removes the entry from the linked list chain, then
* calls the superclass implementation.
*
*
* @param entry the entry to remove
* @param hashIndex the index into the data structure
* @param previous the previous entry in the chain
@ -308,7 +308,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Gets the <code>before</code> field from a <code>LinkEntry</code>.
* Used in subclasses that have no visibility of the field.
*
*
* @param entry the entry to query, must not be null
* @return the <code>before</code> field of the entry
* @throws NullPointerException if the entry is null
@ -321,7 +321,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Gets the <code>after</code> field from a <code>LinkEntry</code>.
* Used in subclasses that have no visibility of the field.
*
*
* @param entry the entry to query, must not be null
* @return the <code>after</code> field of the entry
* @throws NullPointerException if the entry is null
@ -386,11 +386,11 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
}
}
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
/**
* Creates an entry set iterator.
* Subclasses can override this to return iterators with different properties.
*
*
* @return the entrySet iterator
*/
@Override
@ -420,11 +420,11 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
}
}
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
/**
* Creates a key set iterator.
* Subclasses can override this to return iterators with different properties.
*
*
* @return the keySet iterator
*/
@Override
@ -440,7 +440,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
*/
protected static class KeySetIterator<K> extends LinkIterator<K, Object> implements
OrderedIterator<K>, ResettableIterator<K> {
@SuppressWarnings("unchecked")
protected KeySetIterator(final AbstractLinkedMap<K, ?> parent) {
super((AbstractLinkedMap<K, Object>) parent);
@ -455,11 +455,11 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
}
}
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
/**
* Creates a values iterator.
* Subclasses can override this to return iterators with different properties.
*
*
* @return the values iterator
*/
@Override
@ -507,7 +507,7 @@ public abstract class AbstractLinkedMap<K, V> extends AbstractHashedMap<K, V> im
/**
* Constructs a new entry.
*
*
* @param next the next entry in the hash bucket sequence
* @param hashCode the hash code
* @param key the key

View File

@ -66,7 +66,7 @@ public abstract class AbstractMapDecorator<K, V> extends AbstractIterableMap<K,
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
protected Map<K, V> decorated() {
@ -121,7 +121,7 @@ public abstract class AbstractMapDecorator<K, V> extends AbstractIterableMap<K,
public Collection<V> values() {
return decorated().values();
}
@Override
public boolean equals(final Object object) {
if (object == this) {

View File

@ -19,7 +19,7 @@ package org.apache.commons.collections4.map;
import org.apache.commons.collections4.OrderedMap;
import org.apache.commons.collections4.OrderedMapIterator;
/**
/**
* Provides a base decorator that enables additional functionality to be added
* to an OrderedMap via decoration.
* <p>
@ -57,7 +57,7 @@ public abstract class AbstractOrderedMapDecorator<K, V> extends AbstractMapDecor
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
@Override

View File

@ -149,8 +149,8 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
* load factor and initial capacity.
*
* @param keyType the type of reference to use for keys;
* must be {@link ReferenceStrength#HARD HARD},
* {@link ReferenceStrength#SOFT SOFT},
* must be {@link ReferenceStrength#HARD HARD},
* {@link ReferenceStrength#SOFT SOFT},
* {@link ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link ReferenceStrength#HARD},

View File

@ -27,7 +27,7 @@ import org.apache.commons.collections4.IterableSortedMap;
import org.apache.commons.collections4.OrderedMapIterator;
import org.apache.commons.collections4.iterators.ListIteratorWrapper;
/**
/**
* Provides a base decorator that enables additional functionality to be added
* to a Map via decoration.
* <p>
@ -67,7 +67,7 @@ public abstract class AbstractSortedMapDecorator<K, V> extends AbstractMapDecora
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
@Override

View File

@ -29,7 +29,7 @@ import java.util.Map;
* to all lowercase in a locale-independent fashion by using information from the Unicode
* data file.
* <p>
* Null keys are supported.
* Null keys are supported.
* <p>
* The <code>keySet()</code> method returns all lowercase keys, or nulls.
* <p>
@ -54,7 +54,7 @@ import java.util.Map;
* <strong>Note that CaseInsensitiveMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
*
* @since 3.0
@ -73,7 +73,7 @@ public class CaseInsensitiveMap<K, V> extends AbstractHashedMap<K, V> implements
}
/**
* Constructs a new, empty map with the specified initial capacity.
* Constructs a new, empty map with the specified initial capacity.
*
* @param initialCapacity the initial capacity
* @throws IllegalArgumentException if the initial capacity is negative
@ -84,7 +84,7 @@ public class CaseInsensitiveMap<K, V> extends AbstractHashedMap<K, V> implements
/**
* Constructs a new, empty map with the specified initial capacity and
* load factor.
* load factor.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
@ -111,11 +111,11 @@ public class CaseInsensitiveMap<K, V> extends AbstractHashedMap<K, V> implements
//-----------------------------------------------------------------------
/**
* Overrides convertKey() from {@link AbstractHashedMap} to convert keys to
* Overrides convertKey() from {@link AbstractHashedMap} to convert keys to
* lower case.
* <p>
* Returns {@link AbstractHashedMap#NULL} if key is null.
*
*
* @param key the key convert
* @return the converted key
*/
@ -129,7 +129,7 @@ public class CaseInsensitiveMap<K, V> extends AbstractHashedMap<K, V> implements
return new String(chars);
}
return AbstractHashedMap.NULL;
}
}
//-----------------------------------------------------------------------
/**
@ -157,5 +157,5 @@ public class CaseInsensitiveMap<K, V> extends AbstractHashedMap<K, V> implements
in.defaultReadObject();
doReadObject(in);
}
}

View File

@ -53,7 +53,7 @@ import org.apache.commons.collections4.functors.FactoryTransformer;
* <strong>Note that DefaultedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
*
* @since 3.2
@ -74,7 +74,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
* Factory method to create a defaulting map.
* <p>
* The value specified is returned when a missing key is found.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -91,7 +91,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
* <p>
* 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 <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -112,7 +112,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
* The transformer specified is called when a missing key is found.
* 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 <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -135,7 +135,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
* <p>
* The object passed in will be returned by the map whenever an
* unknown key is requested.
*
*
* @param defaultValue the default value to return when the key is not found
*/
public DefaultedMap(final V defaultValue) {
@ -153,7 +153,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @param defaultValueTransformer the value transformer to use
* @throws IllegalArgumentException if map or transformer is null
@ -169,7 +169,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
*/
@ -180,7 +180,7 @@ public class DefaultedMap<K, V> extends AbstractMapDecorator<K, V> implements Se
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException

View File

@ -106,7 +106,7 @@ public class EntrySetToMapIteratorAdapter<K, V> implements MapIterator<K, V>, Re
* Get the currently active entry.
* @return Map.Entry<K, V>
*/
protected synchronized Map.Entry<K, V> current() {
protected synchronized Map.Entry<K, V> current() {
if (entry == null) {
throw new IllegalStateException();
}

View File

@ -36,15 +36,15 @@ import org.apache.commons.collections4.collection.UnmodifiableCollection;
* key however.
* <p>
* If trying to remove or clear the map, an UnsupportedOperationException is
* thrown. If trying to put a new mapping into the map, an
* IllegalArgumentException is thrown. This is because the put method can
* thrown. If trying to put a new mapping into the map, an
* IllegalArgumentException is thrown. This is because the put method can
* succeed if the mapping's key already exists in the map, so the put method
* is not always unsupported.
* <p>
* <strong>Note that FixedSizeMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -61,7 +61,7 @@ public class FixedSizeMap<K, V>
/**
* Factory method to create a fixed size map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -75,7 +75,7 @@ public class FixedSizeMap<K, V>
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
@ -86,7 +86,7 @@ public class FixedSizeMap<K, V>
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -98,13 +98,13 @@ public class FixedSizeMap<K, V>
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
* @since 3.1
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)

View File

@ -38,15 +38,15 @@ import org.apache.commons.collections4.collection.UnmodifiableCollection;
* key however.
* <p>
* If trying to remove or clear the map, an UnsupportedOperationException is
* thrown. If trying to put a new mapping into the map, an
* IllegalArgumentException is thrown. This is because the put method can
* thrown. If trying to put a new mapping into the map, an
* IllegalArgumentException is thrown. This is because the put method can
* succeed if the mapping's key already exists in the map, so the put method
* is not always unsupported.
* <p>
* <strong>Note that FixedSizeSortedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -63,7 +63,7 @@ public class FixedSizeSortedMap<K, V>
/**
* Factory method to create a fixed size sorted map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -77,7 +77,7 @@ public class FixedSizeSortedMap<K, V>
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
@ -87,7 +87,7 @@ public class FixedSizeSortedMap<K, V>
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
protected SortedMap<K, V> getSortedMap() {
@ -106,7 +106,7 @@ public class FixedSizeSortedMap<K, V>
/**
* Read the map in using a custom routine.
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)

View File

@ -795,7 +795,7 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
* <p>
* As a consequence, all subsequent call to {@link #getKey()},
* {@link #setValue(Object)} and {@link #getValue()} will fail.
*
*
* @param flag
*/
void setRemoved(final boolean flag) {

View File

@ -194,7 +194,7 @@ public class LRUMap<K, V>
modCount++;
// remove
if(entry.before == null) {
throw new IllegalStateException("Entry.before is null." +
throw new IllegalStateException("Entry.before is null." +
" Please check that your keys are immutable, and that you have used synchronization properly." +
" If so, then please report this to dev@commons.apache.org as a bug.");
}
@ -426,7 +426,7 @@ public class LRUMap<K, V>
/**
* Writes the data necessary for <code>put()</code> to work in deserialization.
*
*
* @param out the output stream
* @throws IOException if an error occurs while writing to the stream
*/

View File

@ -51,7 +51,7 @@ import org.apache.commons.collections4.functors.FactoryTransformer;
* <strong>Note that LazyMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -69,7 +69,7 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
/**
* Factory method to create a lazily instantiated map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -83,7 +83,7 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
/**
* Factory method to create a lazily instantiated map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -98,7 +98,7 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @param factory the factory to use, must not be null
* @throws IllegalArgumentException if map or factory is null
@ -113,7 +113,7 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @param factory the factory to use, must not be null
* @throws IllegalArgumentException if map or factory is null
@ -129,7 +129,7 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -141,7 +141,7 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K,
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException

View File

@ -48,7 +48,7 @@ import org.apache.commons.collections4.Transformer;
* <strong>Note that LazySortedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -63,7 +63,7 @@ public class LazySortedMap<K,V> extends LazyMap<K,V> implements SortedMap<K,V> {
/**
* Factory method to create a lazily instantiated sorted map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -78,7 +78,7 @@ public class LazySortedMap<K,V> extends LazyMap<K,V> implements SortedMap<K,V> {
/**
* Factory method to create a lazily instantiated sorted map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -94,7 +94,7 @@ public class LazySortedMap<K,V> extends LazyMap<K,V> implements SortedMap<K,V> {
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @param factory the factory to use, must not be null
* @throws IllegalArgumentException if map or factory is null
@ -105,7 +105,7 @@ public class LazySortedMap<K,V> extends LazyMap<K,V> implements SortedMap<K,V> {
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @param factory the factory to use, must not be null
* @throws IllegalArgumentException if map or factory is null
@ -117,7 +117,7 @@ public class LazySortedMap<K,V> extends LazyMap<K,V> implements SortedMap<K,V> {
//-----------------------------------------------------------------------
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
protected SortedMap<K,V> getSortedMap() {

View File

@ -35,7 +35,7 @@ import org.apache.commons.collections4.list.UnmodifiableList;
* A <code>Map</code> implementation that maintains the order of the entries.
* In this implementation order is maintained by original insertion.
* <p>
* This implementation improves on the JDK1.4 LinkedHashMap by adding the
* This implementation improves on the JDK1.4 LinkedHashMap by adding the
* {@link org.apache.commons.collections4.MapIterator MapIterator}
* functionality, additional convenience methods and allowing
* bidirectional iteration. It also implements <code>OrderedMap</code>.
@ -54,7 +54,7 @@ import org.apache.commons.collections4.list.UnmodifiableList;
* <strong>Note that LinkedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
*
* @since 3.0
@ -64,7 +64,7 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
/** Serialisation version */
private static final long serialVersionUID = 9077234323521161066L;
/**
* Constructs a new empty map with default size and load factor.
*/
@ -73,7 +73,7 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
}
/**
* Constructs a new, empty map with the specified initial capacity.
* Constructs a new, empty map with the specified initial capacity.
*
* @param initialCapacity the initial capacity
* @throws IllegalArgumentException if the initial capacity is negative
@ -84,7 +84,7 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
/**
* Constructs a new, empty map with the specified initial capacity and
* load factor.
* load factor.
*
* @param initialCapacity the initial capacity
* @param loadFactor the load factor
@ -115,7 +115,7 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
public LinkedMap<K, V> clone() {
return (LinkedMap<K, V>) super.clone();
}
/**
* Write the map out using a custom routine.
*/
@ -131,11 +131,11 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
in.defaultReadObject();
doReadObject(in);
}
//-----------------------------------------------------------------------
/**
* Gets the key at the specified index.
*
*
* @param index the index to retrieve
* @return the key at the specified index
* @throws IndexOutOfBoundsException if the index is invalid
@ -143,10 +143,10 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
public K get(final int index) {
return getEntry(index).getKey();
}
/**
* Gets the value at the specified index.
*
*
* @param index the index to retrieve
* @return the value at the specified index
* @throws IndexOutOfBoundsException if the index is invalid
@ -154,10 +154,10 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
public V getValue(final int index) {
return getEntry(index).getValue();
}
/**
* Gets the index of the specified key.
*
*
* @param key the key to find the index of
* @return the index, or -1 if not found
*/
@ -197,7 +197,7 @@ public class LinkedMap<K, V> extends AbstractLinkedMap<K, V> implements Serializ
* An alternative to this method is to use {@link #keySet()}.
*
* @see #keySet()
* @return The ordered list of keys.
* @return The ordered list of keys.
*/
public List<K> asList() {
return new LinkedMapList<K>(this);

View File

@ -55,7 +55,7 @@ import org.apache.commons.collections4.list.UnmodifiableList;
* <strong>Note that ListOrderedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* <strong>Note that ListOrderedMap doesn't work with
@ -89,7 +89,7 @@ public class ListOrderedMap<K, V>
* Factory method to create an ordered map.
* <p>
* An <code>ArrayList</code> is used to retain order.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -104,7 +104,7 @@ public class ListOrderedMap<K, V>
/**
* Constructs a new empty <code>ListOrderedMap</code> that decorates
* a <code>HashMap</code>.
*
*
* @since 3.1
*/
public ListOrderedMap() {
@ -113,7 +113,7 @@ public class ListOrderedMap<K, V>
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
@ -125,7 +125,7 @@ public class ListOrderedMap<K, V>
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -137,13 +137,13 @@ public class ListOrderedMap<K, V>
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
* @since 3.1
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)
@ -181,11 +181,11 @@ public class ListOrderedMap<K, V>
}
return insertOrder.get(size() - 1);
}
/**
* Gets the next key to the one specified using insert order.
* This method performs a list search to find the key and is O(n).
*
*
* @param key the key to find previous for
* @return the next key, null if no match or at start
*/
@ -200,7 +200,7 @@ public class ListOrderedMap<K, V>
/**
* Gets the previous key to the one specified using insert order.
* This method performs a list search to find the key and is O(n).
*
*
* @param key the key to find previous for
* @return the previous key, null if no match or at start
*/
@ -342,7 +342,7 @@ public class ListOrderedMap<K, V>
//-----------------------------------------------------------------------
/**
* Returns the Map as a string.
*
*
* @return the Map as a String
*/
@Override
@ -372,7 +372,7 @@ public class ListOrderedMap<K, V>
//-----------------------------------------------------------------------
/**
* Gets the key at the specified index.
*
*
* @param index the index to retrieve
* @return the key at the specified index
* @throws IndexOutOfBoundsException if the index is invalid
@ -380,10 +380,10 @@ public class ListOrderedMap<K, V>
public K get(final int index) {
return insertOrder.get(index);
}
/**
* Gets the value at the specified index.
*
*
* @param index the index to retrieve
* @return the key at the specified index
* @throws IndexOutOfBoundsException if the index is invalid
@ -391,10 +391,10 @@ public class ListOrderedMap<K, V>
public V getValue(final int index) {
return get(insertOrder.get(index));
}
/**
* Gets the index of the specified key.
*
*
* @param key the key to find the index of
* @return the index, or -1 if not found
*/
@ -480,7 +480,7 @@ public class ListOrderedMap<K, V>
*
* @see #keyList()
* @see #keySet()
* @return The ordered list of keys.
* @return The ordered list of keys.
*/
public List<K> asList() {
return keyList();
@ -571,7 +571,7 @@ public class ListOrderedMap<K, V>
}
}
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
static class EntrySetView<K, V> extends AbstractSet<Map.Entry<K, V>> {
private final ListOrderedMap<K, V> parent;
private final List<K> insertOrder;
@ -589,7 +589,7 @@ public class ListOrderedMap<K, V>
}
return entrySet;
}
@Override
public int size() {
return this.parent.size();
@ -656,7 +656,7 @@ public class ListOrderedMap<K, V>
static class ListOrderedIterator<K, V> extends AbstractUntypedIteratorDecorator<K, Map.Entry<K, V>> {
private final ListOrderedMap<K, V> parent;
private K last = null;
ListOrderedIterator(final ListOrderedMap<K, V> parent, final List<K> insertOrder) {
super(insertOrder.iterator());
this.parent = parent;
@ -716,7 +716,7 @@ public class ListOrderedMap<K, V>
readable = true;
return last;
}
public boolean hasPrevious() {
return iterator.hasPrevious();
}

View File

@ -102,7 +102,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
return new MultiKeyMap<K, V>(map);
}
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
/**
* Constructs a new MultiKeyMap that decorates a <code>HashedMap</code>.
*/
@ -126,7 +126,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @return the mapped value, null if no match
@ -146,7 +146,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Checks whether the map contains the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @return true if the map contains the key
@ -166,7 +166,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Stores the value against the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param value the value to store
@ -190,7 +190,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Removes the specified multi-key from this map.
*
*
* @param key1 the first key
* @param key2 the second key
* @return the value mapped to the removed key, null if key not in map
@ -214,7 +214,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Gets the hash code for the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @return the hash code
@ -236,7 +236,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Is the key equal to the combined key.
*
*
* @param entry the entry to compare to
* @param key1 the first key
* @param key2 the second key
@ -254,7 +254,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -275,7 +275,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Checks whether the map contains the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -296,7 +296,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Stores the value against the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -321,7 +321,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Removes the specified multi-key from this map.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -346,7 +346,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Gets the hash code for the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -372,7 +372,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Is the key equal to the combined key.
*
*
* @param entry the entry to compare to
* @param key1 the first key
* @param key2 the second key
@ -392,7 +392,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -414,7 +414,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Checks whether the map contains the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -436,7 +436,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Stores the value against the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -462,7 +462,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Removes the specified multi-key from this map.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -488,7 +488,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Gets the hash code for the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -518,7 +518,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Is the key equal to the combined key.
*
*
* @param entry the entry to compare to
* @param key1 the first key
* @param key2 the second key
@ -540,7 +540,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -563,7 +563,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Checks whether the map contains the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -587,7 +587,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Stores the value against the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -614,7 +614,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Removes the specified multi-key from this map.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -641,7 +641,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Gets the hash code for the specified multi-key.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -675,7 +675,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Is the key equal to the combined key.
*
*
* @param entry the entry to compare to
* @param key1 the first key
* @param key2 the second key
@ -702,7 +702,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
* <p>
* This method removes all the mappings where the <code>MultiKey</code>
* has one or more keys, and the first matches that specified.
*
*
* @param key1 the first key
* @return true if any elements were removed
*/
@ -725,7 +725,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
* <p>
* This method removes all the mappings where the <code>MultiKey</code>
* has two or more keys, and the first two match those specified.
*
*
* @param key1 the first key
* @param key2 the second key
* @return true if any elements were removed
@ -750,7 +750,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
* <p>
* This method removes all the mappings where the <code>MultiKey</code>
* has three or more keys, and the first three match those specified.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -777,7 +777,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
* <p>
* This method removes all the mappings where the <code>MultiKey</code>
* has four or more keys, and the first four match those specified.
*
*
* @param key1 the first key
* @param key2 the second key
* @param key3 the third key
@ -804,7 +804,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
//-----------------------------------------------------------------------
/**
* Check to ensure that input keys are valid MultiKey objects.
*
*
* @param key the key to check
*/
protected void checkKey(final MultiKey<?> key) {
@ -831,7 +831,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Puts the key and value into the map, where the key must be a non-null
* MultiKey object.
*
*
* @param key the non-null MultiKey object
* @param value the value to store
* @return the previous value for the key
@ -847,7 +847,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Copies all of the keys and values from the specified map to this map.
* Each key must be non-null and a MultiKey object.
*
*
* @param mapToCopy to this map
* @throws NullPointerException if the mapToCopy or any key within is null
* @throws ClassCastException if any key in mapToCopy is not a MultiKey
@ -873,11 +873,11 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
protected AbstractHashedMap<MultiKey<? extends K>, V> decorated() {
return (AbstractHashedMap<MultiKey<? extends K>, V>) super.decorated();
}
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
*/
@ -888,7 +888,7 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
@ -898,5 +898,5 @@ public class MultiKeyMap<K, V> extends AbstractMapDecorator<MultiKey<? extends K
in.defaultReadObject();
map = (Map<MultiKey<? extends K>, V>) in.readObject();
}
}

View File

@ -150,7 +150,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 4.0
@ -162,13 +162,13 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
* @since 4.0
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, Object>) in.readObject(); // (1)
@ -302,7 +302,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
* NOTE: the returned Entry objects will contain as value a {@link Collection}
* of all values that are mapped to the given key. To get a "flattened" version
* of all mappings contained in this map, use {@link #iterator()}.
*
*
* @see #iterator()
*/
@Override
@ -421,7 +421,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
public Iterator<Entry<K, V>> iterator() {
final Collection<K> allKeys = new ArrayList<K>(keySet());
final Iterator<K> keyIterator = allKeys.iterator();
return new LazyIteratorChain<Entry<K, V>>() {
@Override
protected Iterator<? extends Entry<K, V>> nextIterator(int count) {

View File

@ -54,7 +54,7 @@ import java.util.concurrent.TimeUnit;
* This class may throw exceptions when accessed by concurrent threads without
* synchronization.
* </p>
*
*
* @param <K> the type of the keys in the map
* @param <V> the type of the values in the map
* @since 4.0
@ -68,7 +68,7 @@ public class PassiveExpiringMap<K, V>
* A {@link org.apache.commons.collections4.map.PassiveExpiringMap.ExpirationPolicy ExpirationPolicy}
* that returns a expiration time that is a
* constant about of time in the future from the current time.
*
*
* @param <K> the type of the keys in the map
* @param <V> the type of the values in the map
* @since 4.0
@ -96,7 +96,7 @@ public class PassiveExpiringMap<K, V>
* milliseconds. A negative time-to-live value indicates entries never
* expire. A zero time-to-live value indicates entries expire (nearly)
* immediately.
*
*
* @param timeToLiveMillis the constant amount of time (in milliseconds)
* an entry is available before it expires. A negative value
* results in entries that NEVER expire. A zero value results in
@ -110,7 +110,7 @@ public class PassiveExpiringMap<K, V>
/**
* Construct a policy with the given time-to-live constant measured in
* the given time unit of measure.
*
*
* @param timeToLive the constant amount of time an entry is available
* before it expires. A negative value results in entries that
* NEVER expire. A zero value results in entries that ALWAYS
@ -126,7 +126,7 @@ public class PassiveExpiringMap<K, V>
/**
* Determine the expiration time for the given key-value entry.
*
*
* @param key the key for the entry (ignored).
* @param value the value for the entry (ignored).
* @return if {@link #timeToLiveMillis} &ge; 0, an expiration time of
@ -155,7 +155,7 @@ public class PassiveExpiringMap<K, V>
/**
* A policy to determine the expiration time for key-value entries.
*
*
* @param <K> the key object type.
* @param <V> the value object type
* @since 4.0
@ -166,7 +166,7 @@ public class PassiveExpiringMap<K, V>
/**
* Determine the expiration time for the given key-value entry.
*
*
* @param key the key for the entry.
* @param value the value for the entry.
* @return the expiration time value measured in milliseconds. A
@ -183,7 +183,7 @@ public class PassiveExpiringMap<K, V>
* the given time measured in the given units to the same time measured in
* milliseconds. If the parameters are invalid, an
* {@link IllegalArgumentException} is thrown.
*
*
* @param timeToLive the constant amount of time an entry is available
* before it expires. A negative value results in entries that NEVER
* expire. A zero value results in entries that ALWAYS expire.
@ -216,7 +216,7 @@ public class PassiveExpiringMap<K, V>
/**
* Construct a map decorator using the given expiration policy to determine
* expiration times.
*
*
* @param expiringPolicy the policy used to determine expiration times of
* entries as they are added.
*/
@ -229,7 +229,7 @@ public class PassiveExpiringMap<K, V>
* expiration policy to determine expiration times. If there are any
* elements already in the map being decorated, they will NEVER expire
* unless they are replaced.
*
*
* @param expiringPolicy the policy used to determine expiration times of
* entries as they are added.
* @param map the map to decorate, must not be null.
@ -248,7 +248,7 @@ public class PassiveExpiringMap<K, V>
* Construct a map decorator that decorates the given map using the given
* time-to-live value measured in milliseconds to create and use a
* {@link ConstantTimeToLiveExpirationPolicy} expiration policy.
*
*
* @param timeToLiveMillis the constant amount of time (in milliseconds) an
* entry is available before it expires. A negative value results in
* entries that NEVER expire. A zero value results in entries that
@ -265,7 +265,7 @@ public class PassiveExpiringMap<K, V>
* {@link ConstantTimeToLiveExpirationPolicy} expiration policy. If there
* are any elements already in the map being decorated, they will NEVER
* expire unless they are replaced.
*
*
* @param timeToLiveMillis the constant amount of time (in milliseconds) an
* entry is available before it expires. A negative value results in
* entries that NEVER expire. A zero value results in entries that
@ -282,7 +282,7 @@ public class PassiveExpiringMap<K, V>
* Construct a map decorator using the given time-to-live value measured in
* the given time units of measure to create and use a
* {@link ConstantTimeToLiveExpirationPolicy} expiration policy.
*
*
* @param timeToLive the constant amount of time an entry is available
* before it expires. A negative value results in entries that NEVER
* expire. A zero value results in entries that ALWAYS expire.
@ -301,7 +301,7 @@ public class PassiveExpiringMap<K, V>
* is used to determine expiration times. If there are any elements already
* in the map being decorated, they will NEVER expire unless they are
* replaced.
*
*
* @param timeToLive the constant amount of time an entry is available
* before it expires. A negative value results in entries that NEVER
* expire. A zero value results in entries that ALWAYS expire.
@ -319,7 +319,7 @@ public class PassiveExpiringMap<K, V>
* Constructs a map decorator that decorates the given map and results in
* entries NEVER expiring. If there are any elements already in the map
* being decorated, they also will NEVER expire.
*
*
* @param map the map to decorate, must not be null.
* @throws IllegalArgumentException if the map is null.
*/
@ -391,7 +391,7 @@ public class PassiveExpiringMap<K, V>
/**
* Determines if the given expiration time is less than <code>now</code>.
*
*
* @param now the time in milliseconds used to compare against the
* expiration time.
* @param expirationTimeObject the expiration time value retrieved from
@ -464,7 +464,7 @@ public class PassiveExpiringMap<K, V>
* Removes all entries in the map whose expiration time is less than
* <code>now</code>. The exceptions are entries with negative expiration
* times; those entries are never removed.
*
*
* @see #isExpired(long, Long)
*/
private void removeAllExpired(final long now) {
@ -505,7 +505,7 @@ public class PassiveExpiringMap<K, V>
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
@ -520,7 +520,7 @@ public class PassiveExpiringMap<K, V>
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
*/

View File

@ -39,7 +39,7 @@ import org.apache.commons.collections4.Predicate;
* <strong>Note that PredicatedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -65,7 +65,7 @@ public class PredicatedMap<K, V>
* <p>
* If there are any elements already in the list being decorated, they
* are validated.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -83,7 +83,7 @@ public class PredicatedMap<K, V>
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @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
@ -94,7 +94,7 @@ public class PredicatedMap<K, V>
super(map);
this.keyPredicate = keyPredicate;
this.valuePredicate = valuePredicate;
final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
while (it.hasNext()) {
final Map.Entry<K, V> entry = it.next();
@ -105,7 +105,7 @@ public class PredicatedMap<K, V>
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -117,13 +117,13 @@ public class PredicatedMap<K, V>
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
* @since 3.1
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)
@ -132,7 +132,7 @@ public class PredicatedMap<K, V>
//-----------------------------------------------------------------------
/**
* Validates a key value pair.
*
*
* @param key the key to validate
* @param value the value to validate
* @throws IllegalArgumentException if invalid
@ -148,7 +148,7 @@ public class PredicatedMap<K, V>
/**
* Override to validate an object set into the map via <code>setValue</code>.
*
*
* @param value the value to validate
* @return the value itself
* @throws IllegalArgumentException if invalid
@ -164,7 +164,7 @@ public class PredicatedMap<K, V>
/**
* Override to only return true when there is a value transformer.
*
*
* @return true if a value predicate is in use
* @since 3.1
*/

View File

@ -35,7 +35,7 @@ import org.apache.commons.collections4.Predicate;
* <strong>Note that PredicatedSortedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -53,7 +53,7 @@ public class PredicatedSortedMap<K, V> extends PredicatedMap<K, V> implements So
* <p>
* If there are any elements already in the list being decorated, they
* are validated.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -70,7 +70,7 @@ public class PredicatedSortedMap<K, V> extends PredicatedMap<K, V> implements So
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @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
@ -84,7 +84,7 @@ public class PredicatedSortedMap<K, V> extends PredicatedMap<K, V> implements So
//-----------------------------------------------------------------------
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
protected SortedMap<K, V> getSortedMap() {

View File

@ -50,7 +50,7 @@ import java.lang.ref.Reference;
* Attempting to add a null key or value to the map will raise a <code>NullPointerException</code>.
* <p>
* This implementation is not synchronized.
* You can use {@link java.util.Collections#synchronizedMap} to
* You can use {@link java.util.Collections#synchronizedMap} to
* provide synchronized access to a <code>ReferenceIdentityMap</code>.
* Remember that synchronization will not stop the garbage collector removing entries.
* <p>
@ -60,7 +60,7 @@ import java.lang.ref.Reference;
* <strong>Note that ReferenceIdentityMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap}. This class may throw
* using {@link java.util.Collections#synchronizedMap}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
*
* @see java.lang.ref.Reference
@ -87,8 +87,8 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* use the specified types of references.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
@ -104,15 +104,15 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* use the specified types of references.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
public ReferenceIdentityMap(final ReferenceStrength keyType, final ReferenceStrength valueType,
final boolean purgeValues) {
@ -124,8 +124,8 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* specified reference types, load factor and initial capacity.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
@ -144,8 +144,8 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* specified reference types, load factor and initial capacity.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
@ -153,8 +153,8 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param capacity the initial capacity for the map
* @param loadFactor the load factor for the map
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
public ReferenceIdentityMap(final ReferenceStrength keyType, final ReferenceStrength valueType,
final int capacity, final float loadFactor, final boolean purgeValues) {
@ -166,7 +166,7 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* Gets the hash code for the key specified.
* <p>
* This implementation uses the identity hash code.
*
*
* @param key the key to get a hash code for
* @return the hash code
*/
@ -179,7 +179,7 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* Gets the hash code for a MapEntry.
* <p>
* This implementation uses the identity hash code.
*
*
* @param key the key to get a hash code for, may be null
* @param value the value to get a hash code for, may be null
* @return the hash code, as per the MapEntry specification
@ -195,7 +195,7 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* <p>
* This implementation converts the key from the entry to a real reference
* before comparison and uses <code>==</code>.
*
*
* @param key1 the first key to compare passed in from outside
* @param key2 the second key extracted from the entry via <code>entry.key</code>
* @return true if equal by identity
@ -210,7 +210,7 @@ public class ReferenceIdentityMap<K, V> extends AbstractReferenceMap<K, V> imple
* Compares two values for equals.
* <p>
* This implementation uses <code>==</code>.
*
*
* @param value1 the first value to compare passed in from outside
* @param value2 the second value extracted from the entry via <code>getValue()</code>
* @return true if equal by identity

View File

@ -48,7 +48,7 @@ import java.io.Serializable;
* Attempting to add a null key or value to the map will raise a <code>NullPointerException</code>.
* <p>
* This implementation is not synchronized.
* You can use {@link java.util.Collections#synchronizedMap} to
* You can use {@link java.util.Collections#synchronizedMap} to
* provide synchronized access to a <code>ReferenceMap</code>.
* Remember that synchronization will not stop the garbage collector removing entries.
* <p>
@ -58,7 +58,7 @@ import java.io.Serializable;
* <strong>Note that ReferenceMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedMap}. This class may throw
* using {@link java.util.Collections#synchronizedMap}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* NOTE: As from Commons Collections 3.1 this map extends <code>AbstractReferenceMap</code>
@ -89,8 +89,8 @@ public class ReferenceMap<K, V> extends AbstractReferenceMap<K, V> implements Se
* use the specified types of references.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
@ -106,15 +106,15 @@ public class ReferenceMap<K, V> extends AbstractReferenceMap<K, V> implements Se
* use the specified types of references.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
public ReferenceMap(final ReferenceStrength keyType, final ReferenceStrength valueType, final boolean purgeValues) {
super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues);
@ -126,8 +126,8 @@ public class ReferenceMap<K, V> extends AbstractReferenceMap<K, V> implements Se
* capacity.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
@ -147,8 +147,8 @@ public class ReferenceMap<K, V> extends AbstractReferenceMap<K, V> implements Se
* capacity.
*
* @param keyType the type of reference to use for keys;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
* {@link AbstractReferenceMap.ReferenceStrength#SOFT SOFT},
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param valueType the type of reference to use for values;
* must be {@link AbstractReferenceMap.ReferenceStrength#HARD HARD},
@ -156,8 +156,8 @@ public class ReferenceMap<K, V> extends AbstractReferenceMap<K, V> implements Se
* {@link AbstractReferenceMap.ReferenceStrength#WEAK WEAK}
* @param capacity the initial capacity for the map
* @param loadFactor the load factor for the map
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
* @param purgeValues should the value be automatically purged when the
* key is garbage collected
*/
public ReferenceMap(final ReferenceStrength keyType, final ReferenceStrength valueType, final int capacity,
final float loadFactor, final boolean purgeValues) {

View File

@ -43,7 +43,7 @@ import org.apache.commons.collections4.keyvalue.TiedMapEntry;
* <p>
* If trying to remove or clear the map, an UnsupportedOperationException is thrown.
* If trying to put a new mapping into the map, an IllegalArgumentException is thrown.
* The put method will only suceed if the key specified is the same as the
* The put method will only suceed if the key specified is the same as the
* singleton key.
* <p>
* The key and value can be obtained by:
@ -131,7 +131,7 @@ public class SingletonMap<K, V>
/**
* Gets the key.
*
* @return the key
* @return the key
*/
public K getKey() {
return key;
@ -171,7 +171,7 @@ public class SingletonMap<K, V>
/**
* Gets the maximum size of the map, always 1.
*
*
* @return 1 always
*/
public int maxSize() {
@ -182,7 +182,7 @@ public class SingletonMap<K, V>
//-----------------------------------------------------------------------
/**
* Gets the value mapped to the key specified.
*
*
* @param key the key
* @return the mapped value, null if no match
*/
@ -195,7 +195,7 @@ public class SingletonMap<K, V>
/**
* Gets the size of the map, always 1.
*
*
* @return the size of 1
*/
public int size() {
@ -204,7 +204,7 @@ public class SingletonMap<K, V>
/**
* Checks whether the map is currently empty, which it never is.
*
*
* @return false always
*/
public boolean isEmpty() {
@ -214,7 +214,7 @@ public class SingletonMap<K, V>
//-----------------------------------------------------------------------
/**
* Checks whether the map contains the specified key.
*
*
* @param key the key to search for
* @return true if the map contains the key
*/
@ -224,7 +224,7 @@ public class SingletonMap<K, V>
/**
* Checks whether the map contains the specified value.
*
*
* @param value the value to search for
* @return true if the map contains the key
*/
@ -238,7 +238,7 @@ public class SingletonMap<K, V>
* <p>
* An IllegalArgumentException is thrown if the key does not match as the map
* is fixed size.
*
*
* @param key the key to set, must be the key of the map
* @param value the value to set
* @return the value previously mapped to this key, null if none
@ -257,7 +257,7 @@ public class SingletonMap<K, V>
* The map must be of size 0 or size 1.
* If it is size 1, the key must match the key of this map otherwise an
* IllegalArgumentException is thrown.
*
*
* @param map the map to add, must be size 0 or 1, and the key must match
* @throws NullPointerException if the map is null
* @throws IllegalArgumentException if the key does not match
@ -276,10 +276,10 @@ public class SingletonMap<K, V>
throw new IllegalArgumentException("The map size must be 0 or 1");
}
}
/**
* Unsupported operation.
*
*
* @param key the mapping to remove
* @return the value mapped to the removed key, null if key not in map
* @throws UnsupportedOperationException always
@ -300,19 +300,19 @@ public class SingletonMap<K, V>
* Gets the entrySet view of the map.
* Changes made via <code>setValue</code> affect this map.
* To simply iterate through the entries, use {@link #mapIterator()}.
*
*
* @return the entrySet view
*/
public Set<Map.Entry<K, V>> entrySet() {
final Map.Entry<K, V> entry = new TiedMapEntry<K, V>(this, getKey());
return Collections.singleton(entry);
}
/**
* Gets the unmodifiable keySet view of the map.
* Changes made to the view affect this map.
* To simply iterate through the keys, use {@link #mapIterator()}.
*
*
* @return the keySet view
*/
public Set<K> keySet() {
@ -323,7 +323,7 @@ public class SingletonMap<K, V>
* Gets the unmodifiable values view of the map.
* Changes made to the view affect this map.
* To simply iterate through the values, use {@link #mapIterator()}.
*
*
* @return the values view
*/
public Collection<V> values() {
@ -339,7 +339,7 @@ public class SingletonMap<K, V>
/**
* Gets the first (and only) key in the map.
*
*
* @return the key
*/
public K firstKey() {
@ -348,7 +348,7 @@ public class SingletonMap<K, V>
/**
* Gets the last (and only) key in the map.
*
*
* @return the key
*/
public K lastKey() {
@ -357,7 +357,7 @@ public class SingletonMap<K, V>
/**
* Gets the next key after the key specified, always null.
*
*
* @param key the next key
* @return null always
*/
@ -367,7 +367,7 @@ public class SingletonMap<K, V>
/**
* Gets the previous key before the key specified, always null.
*
*
* @param key the next key
* @return null always
*/
@ -378,7 +378,7 @@ public class SingletonMap<K, V>
//-----------------------------------------------------------------------
/**
* Compares the specified key to the stored key.
*
*
* @param key the key to compare
* @return true if equal
*/
@ -388,7 +388,7 @@ public class SingletonMap<K, V>
/**
* Compares the specified value to the stored value.
*
*
* @param value the value to compare
* @return true if equal
*/
@ -404,7 +404,7 @@ public class SingletonMap<K, V>
private final SingletonMap<K, V> parent;
private boolean hasNext = true;
private boolean canGetSet = false;
SingletonMapIterator(final SingletonMap<K, V> parent) {
super();
this.parent = parent;
@ -459,11 +459,11 @@ public class SingletonMap<K, V>
}
return parent.setValue(value);
}
public void reset() {
hasNext = true;
}
@Override
public String toString() {
if (hasNext) {
@ -472,7 +472,7 @@ public class SingletonMap<K, V>
return "Iterator[" + getKey() + "=" + getValue() + "]";
}
}
/**
* Values implementation for the SingletonMap.
* This class is needed as values is a view that must update as the map updates.
@ -507,7 +507,7 @@ public class SingletonMap<K, V>
return new SingletonIterator<V>(parent.getValue(), false);
}
}
//-----------------------------------------------------------------------
/**
* Clones the map without cloning the key or value.
@ -526,7 +526,7 @@ public class SingletonMap<K, V>
/**
* Compares this map with another.
*
*
* @param obj the object to compare to
* @return true if equal
*/
@ -548,18 +548,18 @@ public class SingletonMap<K, V>
/**
* Gets the standard Map hashCode.
*
*
* @return the hash code defined in the Map interface
*/
@Override
public int hashCode() {
return (getKey() == null ? 0 : getKey().hashCode()) ^
(getValue() == null ? 0 : getValue().hashCode());
(getValue() == null ? 0 : getValue().hashCode());
}
/**
* Gets the map as a String.
*
*
* @return a string version of the map
*/
@Override

View File

@ -31,7 +31,7 @@ import org.apache.commons.collections4.KeyValue;
* A StaticBucketMap is an efficient, thread-safe implementation of
* <code>java.util.Map</code> that performs well in in a highly
* thread-contentious environment. The map supports very efficient
* {@link #get(Object) get}, {@link #put(Object,Object) put},
* {@link #get(Object) get}, {@link #put(Object,Object) put},
* {@link #remove(Object) remove} and {@link #containsKey(Object) containsKey}
* operations, assuming (approximate) uniform hashing and
* that the number of entries does not exceed the number of buckets. If the
@ -40,16 +40,16 @@ import org.apache.commons.collections4.KeyValue;
* scenario that is proportional to the number of elements in the map
* (<i>O(n)</i>).<p>
*
* Each bucket in the hash table has its own monitor, so two threads can
* safely operate on the map at the same time, often without incurring any
* Each bucket in the hash table has its own monitor, so two threads can
* safely operate on the map at the same time, often without incurring any
* monitor contention. This means that you don't have to wrap instances
* of this class with {@link java.util.Collections#synchronizedMap(Map)};
* instances are already thread-safe. Unfortunately, however, this means
* that this map implementation behaves in ways you may find disconcerting.
* instances are already thread-safe. Unfortunately, however, this means
* that this map implementation behaves in ways you may find disconcerting.
* Bulk operations, such as {@link #putAll(Map) putAll} or the
* {@link Collection#retainAll(Collection) retainAll} operation in collection
* views, are <i>not</i> atomic. If two threads are simultaneously
* executing
* {@link Collection#retainAll(Collection) retainAll} operation in collection
* views, are <i>not</i> atomic. If two threads are simultaneously
* executing
*
* <pre>
* staticBucketMapInstance.putAll(map);
@ -62,23 +62,23 @@ import org.apache.commons.collections4.KeyValue;
* </pre>
*
* then the results are generally random. Those two statement could cancel
* each other out, leaving <code>staticBucketMapInstance</code> essentially
* unchanged, or they could leave some random subset of <code>map</code> in
* each other out, leaving <code>staticBucketMapInstance</code> essentially
* unchanged, or they could leave some random subset of <code>map</code> in
* <code>staticBucketMapInstance</code>.<p>
*
* Also, much like an encyclopedia, the results of {@link #size()} and
* Also, much like an encyclopedia, the results of {@link #size()} and
* {@link #isEmpty()} are out-of-date as soon as they are produced.<p>
*
* The iterators returned by the collection views of this class are <i>not</i>
* fail-fast. They will <i>never</i> raise a
* {@link java.util.ConcurrentModificationException}. Keys and values
* fail-fast. They will <i>never</i> raise a
* {@link java.util.ConcurrentModificationException}. Keys and values
* added to the map after the iterator is created do not necessarily appear
* during iteration. Similarly, the iterator does not necessarily fail to
* during iteration. Similarly, the iterator does not necessarily fail to
* return keys and values that were removed after the iterator was created.<p>
*
* Finally, unlike {@link java.util.HashMap}-style implementations, this
* class <i>never</i> rehashes the map. The number of buckets is fixed
* at construction time and never altered. Performance may degrade if
* class <i>never</i> rehashes the map. The number of buckets is fixed
* at construction time and never altered. Performance may degrade if
* you do not allocate enough buckets upfront.<p>
*
* The {@link #atomic(Runnable)} method is provided to allow atomic iterations
@ -86,8 +86,8 @@ import org.apache.commons.collections4.KeyValue;
* will basically result in a map that's slower than an ordinary synchronized
* {@link java.util.HashMap}.
*
* Use this class if you do not require reliable bulk operations and
* iterations, or if you can make your own guarantees about how bulk
* Use this class if you do not require reliable bulk operations and
* iterations, or if you can make your own guarantees about how bulk
* operations will affect the map.<p>
*
* @since 3.0 (previously in main package v2.1)
@ -168,7 +168,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Gets the current size of the map.
* The value is computed fresh each time the method is called.
*
*
* @return the current size
*/
public int size() {
@ -184,7 +184,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Checks if the size is currently zero.
*
*
* @return true if empty
*/
public boolean isEmpty() {
@ -193,7 +193,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Gets the value associated with the key.
*
*
* @param key the key to retrieve
* @return the associated value
*/
@ -216,7 +216,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Checks if the map contains the specified key.
*
*
* @param key the key to check
* @return true if found
*/
@ -239,7 +239,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Checks if the map contains the specified value.
*
*
* @param value the value to check
* @return true if found
*/
@ -263,7 +263,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
//-----------------------------------------------------------------------
/**
* Puts a new key value mapping into the map.
*
*
* @param key the key to use
* @param value the value to use
* @return the previous mapping for the key
@ -309,7 +309,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Removes the specified key from the map.
*
*
* @param key the key to remove
* @return the previous value at this key
*/
@ -344,7 +344,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
//-----------------------------------------------------------------------
/**
* Gets the key set.
*
*
* @return the key set
*/
public Set<K> keySet() {
@ -353,7 +353,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Gets the values.
*
*
* @return the values
*/
public Collection<V> values() {
@ -362,7 +362,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Gets the entry set.
*
*
* @return the entry set
*/
public Set<Map.Entry<K, V>> entrySet() {
@ -373,7 +373,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Puts all the entries from the specified map into this map.
* This operation is <b>not atomic</b> and may have undesired effects.
*
*
* @param map the map of entries to add
*/
public void putAll(final Map<? extends K, ? extends V> map) {
@ -397,7 +397,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Compares this map to another, as per the Map specification.
*
*
* @param obj the object to compare to
* @return true if equal
*/
@ -415,7 +415,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Gets the hash code, as per the Map specification.
*
*
* @return the hash code
*/
@Override
@ -667,7 +667,7 @@ public final class StaticBucketMap<K, V> extends AbstractIterableMap<K, V> {
/**
* Prevents any operations from occurring on this map while the
* given {@link Runnable} executes. This method can be used, for
* instance, to execute a bulk operation atomically:
* instance, to execute a bulk operation atomically:
*
* <pre>
* staticBucketMapInstance.atomic(new Runnable() {

View File

@ -147,7 +147,7 @@ public class TransformedMap<K, V>
* @throws ClassNotFoundException
* @since 3.1
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)

View File

@ -33,7 +33,7 @@ import org.apache.commons.collections4.Transformer;
* <strong>Note that TransformedSortedMap is not synchronized and is not thread-safe.</strong>
* If you wish to use this map from multiple threads concurrently, you must use
* appropriate synchronization. The simplest approach is to wrap this map
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* using {@link java.util.Collections#synchronizedSortedMap}. This class may throw
* exceptions when accessed by concurrent threads without synchronization.
* <p>
* This class is Serializable from Commons Collections 3.1.
@ -47,13 +47,13 @@ public class TransformedSortedMap<K, V>
/** Serialization version */
private static final long serialVersionUID = -8751771676410385778L;
/**
* Factory method to create a transforming sorted map.
* <p>
* If there are any elements already in the map being decorated, they are NOT transformed.
* Contrast this with {@link #transformedSortedMap(SortedMap, Transformer, Transformer)}.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -75,7 +75,7 @@ public class TransformedSortedMap<K, V>
* If there are any elements already in the map being decorated, they
* will be transformed by this method.
* Contrast this with {@link #transformingSortedMap(SortedMap, Transformer, Transformer)}.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -105,7 +105,7 @@ public class TransformedSortedMap<K, V>
* <p>
* If there are any elements already in the collection being decorated, they
* are NOT transformed.</p>
*
*
* @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
@ -120,7 +120,7 @@ public class TransformedSortedMap<K, V>
//-----------------------------------------------------------------------
/**
* Gets the map being decorated.
*
*
* @return the decorated map
*/
protected SortedMap<K, V> getSortedMap() {

View File

@ -30,7 +30,7 @@ import org.apache.commons.collections4.keyvalue.AbstractMapEntryDecorator;
/**
* Decorates a map entry <code>Set</code> to ensure it can't be altered.
* <p>
* Attempts to modify it will result in an UnsupportedOperationException.
* Attempts to modify it will result in an UnsupportedOperationException.
*
* @since 3.0
* @version $Id$
@ -43,7 +43,7 @@ public final class UnmodifiableEntrySet<K, V>
/**
* Factory method to create an unmodifiable set of Map Entry objects.
*
*
* @param <K> the key type
* @param <V> the value type
* @param set the set to decorate, must not be null
@ -60,7 +60,7 @@ public final class UnmodifiableEntrySet<K, V>
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param set the set to decorate, must not be null
* @throws IllegalArgumentException if set is null
*/
@ -104,7 +104,7 @@ public final class UnmodifiableEntrySet<K, V>
public Iterator<Map.Entry<K, V>> iterator() {
return new UnmodifiableEntrySetIterator(collection.iterator());
}
@Override
@SuppressWarnings("unchecked")
public Object[] toArray() {
@ -114,7 +114,7 @@ public final class UnmodifiableEntrySet<K, V>
}
return array;
}
@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(final T[] array) {
@ -141,7 +141,7 @@ public final class UnmodifiableEntrySet<K, V>
}
return array;
}
//-----------------------------------------------------------------------
/**
* Implementation of an entry set iterator.

View File

@ -37,7 +37,7 @@ import org.apache.commons.collections4.iterators.UnmodifiableMapIterator;
* <p>
* This class is Serializable from Commons Collections 3.1.
* <p>
* Attempts to modify it will result in an UnsupportedOperationException.
* Attempts to modify it will result in an UnsupportedOperationException.
*
* @since 3.0
* @version $Id$
@ -51,7 +51,7 @@ public final class UnmodifiableMap<K, V>
/**
* Factory method to create an unmodifiable map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -68,7 +68,7 @@ public final class UnmodifiableMap<K, V>
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
@ -79,7 +79,7 @@ public final class UnmodifiableMap<K, V>
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -91,7 +91,7 @@ public final class UnmodifiableMap<K, V>
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException

View File

@ -36,7 +36,7 @@ import org.apache.commons.collections4.iterators.UnmodifiableOrderedMapIterator;
* <p>
* This class is Serializable from Commons Collections 3.1.
* <p>
* Attempts to modify it will result in an UnsupportedOperationException.
* Attempts to modify it will result in an UnsupportedOperationException.
*
* @since 3.0
* @version $Id$
@ -49,7 +49,7 @@ public final class UnmodifiableOrderedMap<K, V> extends AbstractOrderedMapDecora
/**
* Factory method to create an unmodifiable sorted map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -66,7 +66,7 @@ public final class UnmodifiableOrderedMap<K, V> extends AbstractOrderedMapDecora
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
@ -77,7 +77,7 @@ public final class UnmodifiableOrderedMap<K, V> extends AbstractOrderedMapDecora
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -89,13 +89,13 @@ public final class UnmodifiableOrderedMap<K, V> extends AbstractOrderedMapDecora
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException
* @since 3.1
*/
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
@SuppressWarnings("unchecked") // (1) should only fail if input stream is incorrect
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
map = (Map<K, V>) in.readObject(); // (1)

View File

@ -35,7 +35,7 @@ import org.apache.commons.collections4.collection.UnmodifiableCollection;
* <p>
* This class is Serializable from Commons Collections 3.1.
* <p>
* Attempts to modify it will result in an UnsupportedOperationException.
* Attempts to modify it will result in an UnsupportedOperationException.
*
* @since 3.0
* @version $Id$
@ -49,7 +49,7 @@ public final class UnmodifiableSortedMap<K, V>
/**
* Factory method to create an unmodifiable sorted map.
*
*
* @param <K> the key type
* @param <V> the value type
* @param map the map to decorate, must not be null
@ -66,18 +66,18 @@ public final class UnmodifiableSortedMap<K, V>
//-----------------------------------------------------------------------
/**
* Constructor that wraps (not copies).
*
*
* @param map the map to decorate, must not be null
* @throws IllegalArgumentException if map is null
*/
private UnmodifiableSortedMap(final SortedMap<K, V> map) {
super(map);
}
//-----------------------------------------------------------------------
/**
* Write the map out using a custom routine.
*
*
* @param out the output stream
* @throws IOException
* @since 3.1
@ -89,7 +89,7 @@ public final class UnmodifiableSortedMap<K, V>
/**
* Read the map in using a custom routine.
*
*
* @param in the input stream
* @throws IOException
* @throws ClassNotFoundException