Javadoc: Replace <code></code> HTML tags with Javadoc {@code} notation.
This commit is contained in:
parent
513ae545ee
commit
0eb36e1c78
|
@ -21,18 +21,18 @@ import java.util.EmptyStackException;
|
|||
|
||||
/**
|
||||
* An implementation of the {@link java.util.Stack} API that is based on an
|
||||
* <code>ArrayList</code> instead of a <code>Vector</code>, so it is not
|
||||
* {@code ArrayList} instead of a {@code Vector}, so it is not
|
||||
* synchronized to protect against multi-threaded access. The implementation
|
||||
* is therefore operates faster in environments where you do not need to
|
||||
* worry about multiple thread contention.
|
||||
* <p>
|
||||
* The removal order of an <code>ArrayStack</code> is based on insertion
|
||||
* The removal order of an {@code ArrayStack} is based on insertion
|
||||
* order: The most recently added element is removed first. The iteration
|
||||
* order is <i>not</i> the same as the removal order. The iterator returns
|
||||
* elements from the bottom up.
|
||||
* </p>
|
||||
* <p>
|
||||
* Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries.
|
||||
* Unlike {@code Stack}, {@code ArrayStack} accepts null entries.
|
||||
* <p>
|
||||
* <b>Note:</b> From version 4.0 onwards, this class does not implement the
|
||||
* removed {@code Buffer} interface anymore.
|
||||
|
@ -50,15 +50,15 @@ public class ArrayStack<E> extends ArrayList<E> {
|
|||
private static final long serialVersionUID = 2130079159931574599L;
|
||||
|
||||
/**
|
||||
* Constructs a new empty <code>ArrayStack</code>. The initial size
|
||||
* is controlled by <code>ArrayList</code> and is currently 10.
|
||||
* Constructs a new empty {@code ArrayStack}. The initial size
|
||||
* is controlled by {@code ArrayList} and is currently 10.
|
||||
*/
|
||||
public ArrayStack() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new empty <code>ArrayStack</code> with an initial size.
|
||||
* Constructs a new empty {@code ArrayStack} with an initial size.
|
||||
*
|
||||
* @param initialSize the initial size to use
|
||||
* @throws IllegalArgumentException if the specified initial size
|
||||
|
@ -69,10 +69,10 @@ public class ArrayStack<E> extends ArrayList<E> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return <code>true</code> if this stack is currently empty.
|
||||
* Return {@code true} if this stack is currently empty.
|
||||
* <p>
|
||||
* This method exists for compatibility with <code>java.util.Stack</code>.
|
||||
* New users of this class should use <code>isEmpty</code> instead.
|
||||
* This method exists for compatibility with {@code java.util.Stack}.
|
||||
* New users of this class should use {@code isEmpty} instead.
|
||||
*
|
||||
* @return true if the stack is currently empty
|
||||
*/
|
||||
|
@ -127,7 +127,7 @@ public class ArrayStack<E> extends ArrayList<E> {
|
|||
|
||||
/**
|
||||
* Pushes a new item onto the top of this stack. The pushed item is also
|
||||
* returned. This is equivalent to calling <code>add</code>.
|
||||
* returned. This is equivalent to calling {@code add}.
|
||||
*
|
||||
* @param item the item to be added
|
||||
* @return the item just pushed
|
||||
|
@ -140,9 +140,9 @@ public class ArrayStack<E> extends ArrayList<E> {
|
|||
/**
|
||||
* Returns the one-based position of the distance from the top that the
|
||||
* specified object exists on this stack, where the top-most element is
|
||||
* considered to be at distance <code>1</code>. If the object is not
|
||||
* present on the stack, return <code>-1</code> instead. The
|
||||
* <code>equals()</code> method is used to compare to the items
|
||||
* considered to be at distance {@code 1}. If the object is not
|
||||
* present on the stack, return {@code -1} instead. The
|
||||
* {@code equals()} method is used to compare to the items
|
||||
* in this stack.
|
||||
*
|
||||
* @param object the object to be searched for
|
||||
|
|
|
@ -24,16 +24,16 @@ import java.util.Set;
|
|||
* Defines a collection that counts the number of times an object appears in
|
||||
* the collection.
|
||||
* <p>
|
||||
* Suppose you have a Bag that contains <code>{a, a, b, c}</code>.
|
||||
* Calling {@link #getCount(Object)} on <code>a</code> would return 2, while
|
||||
* calling {@link #uniqueSet()} would return <code>{a, b, c}</code>.
|
||||
* Suppose you have a Bag that contains {@code {a, a, b, c}}.
|
||||
* Calling {@link #getCount(Object)} on {@code a} would return 2, while
|
||||
* calling {@link #uniqueSet()} would return {@code {a, b, c}}.
|
||||
* </p>
|
||||
* <p>
|
||||
* <i>NOTE: This interface violates the {@link Collection} contract.</i>
|
||||
* The behavior specified in many of these methods is <i>not</i> the same
|
||||
* as the behavior specified by <code>Collection</code>.
|
||||
* as the behavior specified by {@code Collection}.
|
||||
* The noncompliant methods are clearly marked with "(Violation)".
|
||||
* Exercise caution when using a bag as a <code>Collection</code>.
|
||||
* Exercise caution when using a bag as a {@code Collection}.
|
||||
* </p>
|
||||
* <p>
|
||||
* This violation resulted from the original specification of this interface.
|
||||
|
@ -67,27 +67,27 @@ public interface Bag<E> extends Collection<E> {
|
|||
* <p>
|
||||
* Since this method always increases the size of the bag,
|
||||
* according to the {@link Collection#add(Object)} contract, it
|
||||
* should always return <code>true</code>. Since it sometimes returns
|
||||
* <code>false</code>, this method violates the contract.
|
||||
* should always return {@code true}. Since it sometimes returns
|
||||
* {@code false}, this method violates the contract.
|
||||
* </p>
|
||||
*
|
||||
* @param object the object to add
|
||||
* @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
|
||||
* @return {@code true} if the object was not already in the {@code uniqueSet}
|
||||
*/
|
||||
@Override
|
||||
boolean add(E object);
|
||||
|
||||
/**
|
||||
* Adds <code>nCopies</code> copies of the specified object to the Bag.
|
||||
* Adds {@code nCopies} copies of the specified object to the Bag.
|
||||
* <p>
|
||||
* If the object is already in the {@link #uniqueSet()} then increment its
|
||||
* count as reported by {@link #getCount(Object)}. Otherwise add it to the
|
||||
* {@link #uniqueSet()} and report its count as <code>nCopies</code>.
|
||||
* {@link #uniqueSet()} and report its count as {@code nCopies}.
|
||||
* </p>
|
||||
*
|
||||
* @param object the object to add
|
||||
* @param nCopies the number of copies to add
|
||||
* @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
|
||||
* @return {@code true} if the object was not already in the {@code uniqueSet}
|
||||
*/
|
||||
boolean add(E object, int nCopies);
|
||||
|
||||
|
@ -104,13 +104,13 @@ public interface Bag<E> extends Collection<E> {
|
|||
* </p>
|
||||
*
|
||||
* @param object the object to remove
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
boolean remove(Object object);
|
||||
|
||||
/**
|
||||
* Removes <code>nCopies</code> copies of the specified object from the Bag.
|
||||
* Removes {@code nCopies} copies of the specified object from the Bag.
|
||||
* <p>
|
||||
* If the number of copies to remove is greater than the actual number of
|
||||
* copies in the Bag, no error is thrown.
|
||||
|
@ -118,7 +118,7 @@ public interface Bag<E> extends Collection<E> {
|
|||
*
|
||||
* @param object the object to remove
|
||||
* @param nCopies the number of copies to remove
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
boolean remove(Object object, int nCopies);
|
||||
|
||||
|
@ -142,11 +142,11 @@ public interface Bag<E> extends Collection<E> {
|
|||
|
||||
/**
|
||||
* <i>(Violation)</i>
|
||||
* Returns <code>true</code> if the bag contains all elements in
|
||||
* Returns {@code true} if the bag contains all elements in
|
||||
* the given collection, respecting cardinality. That is, if the
|
||||
* given collection <code>coll</code> contains <code>n</code> copies
|
||||
* given collection {@code coll} contains {@code n} copies
|
||||
* of a given object, calling {@link #getCount(Object)} on that object must
|
||||
* be <code>>= n</code> for all <code>n</code> in <code>coll</code>.
|
||||
* be {@code >= n} for all {@code n} in {@code coll}.
|
||||
*
|
||||
* <p>
|
||||
* The {@link Collection#containsAll(Collection)} method specifies
|
||||
|
@ -156,7 +156,7 @@ public interface Bag<E> extends Collection<E> {
|
|||
* </p>
|
||||
*
|
||||
* @param coll the collection to check against
|
||||
* @return <code>true</code> if the Bag contains all the collection
|
||||
* @return {@code true} if the Bag contains all the collection
|
||||
*/
|
||||
@Override
|
||||
boolean containsAll(Collection<?> coll);
|
||||
|
@ -165,9 +165,9 @@ public interface Bag<E> extends Collection<E> {
|
|||
* <i>(Violation)</i>
|
||||
* Remove all elements represented in the given collection,
|
||||
* respecting cardinality. That is, if the given collection
|
||||
* <code>coll</code> contains <code>n</code> copies of a given object,
|
||||
* the bag will have <code>n</code> fewer copies, assuming the bag
|
||||
* had at least <code>n</code> copies to begin with.
|
||||
* {@code coll} contains {@code n} copies of a given object,
|
||||
* the bag will have {@code n} fewer copies, assuming the bag
|
||||
* had at least {@code n} copies to begin with.
|
||||
*
|
||||
* <p>
|
||||
* The {@link Collection#removeAll(Collection)} method specifies
|
||||
|
@ -177,7 +177,7 @@ public interface Bag<E> extends Collection<E> {
|
|||
* </p>
|
||||
*
|
||||
* @param coll the collection to remove
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
boolean removeAll(Collection<?> coll);
|
||||
|
@ -186,11 +186,11 @@ public interface Bag<E> extends Collection<E> {
|
|||
* <i>(Violation)</i>
|
||||
* Remove any members of the bag that are not in the given
|
||||
* collection, respecting cardinality. That is, if the given
|
||||
* collection <code>coll</code> contains <code>n</code> copies of a
|
||||
* given object and the bag has <code>m > n</code> copies, then
|
||||
* delete <code>m - n</code> copies from the bag. In addition, if
|
||||
* <code>e</code> is an object in the bag but
|
||||
* <code>!coll.contains(e)</code>, then remove <code>e</code> and any
|
||||
* collection {@code coll} contains {@code n} copies of a
|
||||
* given object and the bag has {@code m > n} copies, then
|
||||
* delete {@code m - n} copies from the bag. In addition, if
|
||||
* {@code e} is an object in the bag but
|
||||
* {@code !coll.contains(e)}, then remove {@code e} and any
|
||||
* of its copies.
|
||||
*
|
||||
* <p>
|
||||
|
@ -201,7 +201,7 @@ public interface Bag<E> extends Collection<E> {
|
|||
* </p>
|
||||
*
|
||||
* @param coll the collection to retain
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
boolean retainAll(Collection<?> coll);
|
||||
|
@ -233,7 +233,7 @@ public interface Bag<E> extends Collection<E> {
|
|||
// * Gets a hash code for the Bag compatible with the definition of equals.
|
||||
// * The hash code is defined as the sum total of a hash code for each element.
|
||||
// * The per element hash code is defined as
|
||||
// * <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>.
|
||||
// * {@code (e==null ? 0 : e.hashCode()) ^ noOccurances)}.
|
||||
// * This hash code definition is compatible with the Set interface.
|
||||
// *
|
||||
// * @return the hash code of the Bag
|
||||
|
|
|
@ -246,7 +246,7 @@ public class BagUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an empty <code>Bag</code>.
|
||||
* Get an empty {@code Bag}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return an empty Bag
|
||||
|
@ -257,7 +257,7 @@ public class BagUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an empty <code>SortedBag</code>.
|
||||
* Get an empty {@code SortedBag}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return an empty sorted Bag
|
||||
|
|
|
@ -21,11 +21,11 @@ import java.util.Set;
|
|||
/**
|
||||
* Defines a map that allows bidirectional lookup between key and values.
|
||||
* <p>
|
||||
* This extended <code>Map</code> represents a mapping where a key may
|
||||
* This extended {@code Map} represents a mapping where a key may
|
||||
* lookup a value and a value may lookup a key with equal ease.
|
||||
* This interface extends <code>Map</code> and so may be used anywhere a map
|
||||
* This interface extends {@code Map} and so may be used anywhere a map
|
||||
* is required. The interface provides an inverse map view, enabling
|
||||
* full access to both directions of the <code>BidiMap</code>.
|
||||
* full access to both directions of the {@code BidiMap}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Implementations should allow a value to be looked up from a key and
|
||||
|
@ -66,7 +66,7 @@ public interface BidiMap<K, V> extends IterableMap<K, V> {
|
|||
* @param value the value to store
|
||||
* @return the previous value mapped to this key
|
||||
*
|
||||
* @throws UnsupportedOperationException if the <code>put</code> method is not supported
|
||||
* @throws UnsupportedOperationException if the {@code put} method is not supported
|
||||
* @throws ClassCastException (optional) if the map limits the type of the
|
||||
* value and the specified value is inappropriate
|
||||
* @throws IllegalArgumentException (optional) if the map limits the values
|
||||
|
@ -80,15 +80,15 @@ public interface BidiMap<K, V> extends IterableMap<K, V> {
|
|||
/**
|
||||
* Gets the key that is currently mapped to the specified value.
|
||||
* <p>
|
||||
* If the value is not contained in the map, <code>null</code> is returned.
|
||||
* If the value is not contained in the map, {@code null} is returned.
|
||||
* </p>
|
||||
* <p>
|
||||
* Implementations should seek to make this method perform equally as well
|
||||
* as <code>get(Object)</code>.
|
||||
* as {@code get(Object)}.
|
||||
* </p>
|
||||
*
|
||||
* @param value the value to find the key for
|
||||
* @return the mapped key, or <code>null</code> if not found
|
||||
* @return the mapped key, or {@code null} if not found
|
||||
*
|
||||
* @throws ClassCastException (optional) if the map limits the type of the
|
||||
* value and the specified value is inappropriate
|
||||
|
@ -101,15 +101,15 @@ public interface BidiMap<K, V> extends IterableMap<K, V> {
|
|||
* Removes the key-value pair that is currently mapped to the specified
|
||||
* value (optional operation).
|
||||
* <p>
|
||||
* If the value is not contained in the map, <code>null</code> is returned.
|
||||
* If the value is not contained in the map, {@code null} is returned.
|
||||
* </p>
|
||||
* <p>
|
||||
* Implementations should seek to make this method perform equally as well
|
||||
* as <code>remove(Object)</code>.
|
||||
* as {@code remove(Object)}.
|
||||
* </p>
|
||||
*
|
||||
* @param value the value to find the key-value pair for
|
||||
* @return the key that was removed, <code>null</code> if nothing removed
|
||||
* @return the key that was removed, {@code null} if nothing removed
|
||||
*
|
||||
* @throws ClassCastException (optional) if the map limits the type of the
|
||||
* value and the specified value is inappropriate
|
||||
|
@ -124,11 +124,11 @@ public interface BidiMap<K, V> extends IterableMap<K, V> {
|
|||
* Gets a view of this map where the keys and values are reversed.
|
||||
* <p>
|
||||
* Changes to one map will be visible in the other and vice versa.
|
||||
* This enables both directions of the map to be accessed as a <code>Map</code>.
|
||||
* This enables both directions of the map to be accessed as a {@code Map}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Implementations should seek to avoid creating a new object every time this
|
||||
* method is called. See <code>AbstractMap.values()</code> etc. Calling this
|
||||
* method is called. See {@code AbstractMap.values()} etc. Calling this
|
||||
* method on the inverse map should return the original.
|
||||
* </p>
|
||||
*
|
||||
|
|
|
@ -37,7 +37,7 @@ public interface BoundedCollection<E> extends Collection<E> {
|
|||
/**
|
||||
* Returns true if this collection is full and no new elements can be added.
|
||||
*
|
||||
* @return <code>true</code> if the collection is full.
|
||||
* @return {@code true} if the collection is full.
|
||||
*/
|
||||
boolean isFull();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public interface BoundedMap<K, V> extends IterableMap<K, V> {
|
|||
/**
|
||||
* Returns true if this map is full and no new elements can be added.
|
||||
*
|
||||
* @return <code>true</code> if the map is full
|
||||
* @return {@code true} if the map is full
|
||||
*/
|
||||
boolean isFull();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.commons.collections4;
|
|||
/**
|
||||
* Defines a functor interface implemented by classes that do something.
|
||||
* <p>
|
||||
* A <code>Closure</code> represents a block of code which is executed from
|
||||
* A {@code Closure} represents a block of code which is executed from
|
||||
* inside some block, function or iteration. It operates an input object.
|
||||
* </p>
|
||||
* <p>
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.commons.collections4.functors.TransformerClosure;
|
|||
import org.apache.commons.collections4.functors.WhileClosure;
|
||||
|
||||
/**
|
||||
* <code>ClosureUtils</code> provides reference implementations and utilities
|
||||
* {@code ClosureUtils} provides reference implementations and utilities
|
||||
* for the Closure functor interface. The supplied closures are:
|
||||
* <ul>
|
||||
* <li>Invoker - invokes a method on the input object
|
||||
|
@ -107,16 +107,16 @@ public class ClosureUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a Closure that will call the closure <code>count</code> times.
|
||||
* Creates a Closure that will call the closure {@code count} times.
|
||||
* <p>
|
||||
* A null closure or zero count returns the <code>NOPClosure</code>.
|
||||
* A null closure or zero count returns the {@code NOPClosure}.
|
||||
*
|
||||
* @see org.apache.commons.collections4.functors.ForClosure
|
||||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param count the number of times to loop
|
||||
* @param closure the closure to call repeatedly
|
||||
* @return the <code>for</code> closure
|
||||
* @return the {@code for} closure
|
||||
*/
|
||||
public static <E> Closure<E> forClosure(final int count, final Closure<? super E> closure) {
|
||||
return ForClosure.forClosure(count, closure);
|
||||
|
@ -131,7 +131,7 @@ public class ClosureUtils {
|
|||
* @param <E> the type that the closure acts on
|
||||
* @param predicate the predicate to use as an end of loop test, not null
|
||||
* @param closure the closure to call repeatedly, not null
|
||||
* @return the <code>while</code> closure
|
||||
* @return the {@code while} closure
|
||||
* @throws NullPointerException if either argument is null
|
||||
*/
|
||||
public static <E> Closure<E> whileClosure(final Predicate<? super E> predicate, final Closure<? super E> closure) {
|
||||
|
@ -147,7 +147,7 @@ public class ClosureUtils {
|
|||
* @param <E> the type that the closure acts on
|
||||
* @param closure the closure to call repeatedly, not null
|
||||
* @param predicate the predicate to use as an end of loop test, not null
|
||||
* @return the <code>do-while</code> closure
|
||||
* @return the {@code do-while} closure
|
||||
* @throws NullPointerException if either argument is null
|
||||
*/
|
||||
public static <E> Closure<E> doWhileClosure(final Closure<? super E> closure,
|
||||
|
@ -164,7 +164,7 @@ public class ClosureUtils {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param methodName the name of the method
|
||||
* @return the <code>invoker</code> closure
|
||||
* @return the {@code invoker} closure
|
||||
* @throws NullPointerException if the method name is null
|
||||
*/
|
||||
public static <E> Closure<E> invokerClosure(final String methodName) {
|
||||
|
@ -183,7 +183,7 @@ public class ClosureUtils {
|
|||
* @param methodName the name of the method
|
||||
* @param paramTypes the parameter types
|
||||
* @param args the arguments
|
||||
* @return the <code>invoker</code> closure
|
||||
* @return the {@code invoker} closure
|
||||
* @throws NullPointerException if the method name is null
|
||||
* @throws IllegalArgumentException if the paramTypes and args don't match
|
||||
*/
|
||||
|
@ -201,7 +201,7 @@ public class ClosureUtils {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param closures an array of closures to chain
|
||||
* @return the <code>chained</code> closure
|
||||
* @return the {@code chained} closure
|
||||
* @throws NullPointerException if the closures array is null
|
||||
* @throws NullPointerException if any closure in the array is null
|
||||
*/
|
||||
|
@ -218,7 +218,7 @@ public class ClosureUtils {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param closures a collection of closures to chain
|
||||
* @return the <code>chained</code> closure
|
||||
* @return the {@code chained} closure
|
||||
* @throws NullPointerException if the closures collection is null
|
||||
* @throws NullPointerException if any closure in the collection is null
|
||||
* @throws IllegalArgumentException if the closures collection is empty
|
||||
|
@ -236,7 +236,7 @@ public class ClosureUtils {
|
|||
* @param <E> the type that the closure acts on
|
||||
* @param predicate the validating predicate
|
||||
* @param trueClosure the closure called if the predicate is true
|
||||
* @return the <code>if</code> closure
|
||||
* @return the {@code if} closure
|
||||
* @throws NullPointerException if the predicate or closure is null
|
||||
* @since 3.2
|
||||
*/
|
||||
|
@ -255,7 +255,7 @@ public class ClosureUtils {
|
|||
* @param predicate the predicate to switch on
|
||||
* @param trueClosure the closure called if the predicate is true
|
||||
* @param falseClosure the closure called if the predicate is false
|
||||
* @return the <code>switch</code> closure
|
||||
* @return the {@code switch} closure
|
||||
* @throws NullPointerException if the predicate or either closure is null
|
||||
*/
|
||||
public static <E> Closure<E> ifClosure(final Predicate<? super E> predicate,
|
||||
|
@ -277,7 +277,7 @@ public class ClosureUtils {
|
|||
* @param <E> the type that the closure acts on
|
||||
* @param predicates an array of predicates to check, not null
|
||||
* @param closures an array of closures to call, not null
|
||||
* @return the <code>switch</code> closure
|
||||
* @return the {@code switch} closure
|
||||
* @throws NullPointerException if the either array is null
|
||||
* @throws NullPointerException if any element in the arrays is null
|
||||
* @throws IllegalArgumentException if the arrays have different sizes
|
||||
|
@ -302,7 +302,7 @@ public class ClosureUtils {
|
|||
* @param predicates an array of predicates to check, not null
|
||||
* @param closures an array of closures to call, not null
|
||||
* @param defaultClosure the default to call if no predicate matches
|
||||
* @return the <code>switch</code> closure
|
||||
* @return the {@code switch} closure
|
||||
* @throws NullPointerException if the either array is null
|
||||
* @throws NullPointerException if any element in the arrays is null
|
||||
* @throws IllegalArgumentException if the arrays are different sizes
|
||||
|
@ -328,7 +328,7 @@ public class ClosureUtils {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param predicatesAndClosures a map of predicates to closures
|
||||
* @return the <code>switch</code> closure
|
||||
* @return the {@code switch} closure
|
||||
* @throws NullPointerException if the map is null
|
||||
* @throws NullPointerException if any closure in the map is null
|
||||
* @throws IllegalArgumentException if the map is empty
|
||||
|
|
|
@ -185,7 +185,7 @@ public class CollectionUtils {
|
|||
public static final Collection EMPTY_COLLECTION = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* <code>CollectionUtils</code> should not normally be instantiated.
|
||||
* {@code CollectionUtils} should not normally be instantiated.
|
||||
*/
|
||||
private CollectionUtils() {}
|
||||
|
||||
|
@ -203,12 +203,12 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable empty collection if the argument is <code>null</code>,
|
||||
* Returns an immutable empty collection if the argument is {@code null},
|
||||
* or the argument itself otherwise.
|
||||
*
|
||||
* @param <T> the element type
|
||||
* @param collection the collection, possibly <code>null</code>
|
||||
* @return an empty collection if the argument is <code>null</code>
|
||||
* @param collection the collection, possibly {@code null}
|
||||
* @return an empty collection if the argument is {@code null}
|
||||
*/
|
||||
public static <T> Collection<T> emptyIfNull(final Collection<T> collection) {
|
||||
return collection == null ? CollectionUtils.<T>emptyCollection() : collection;
|
||||
|
@ -355,11 +355,11 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff all elements of {@code coll2} are also contained
|
||||
* Returns {@code true} iff all elements of {@code coll2} are also contained
|
||||
* in {@code coll1}. The cardinality of values in {@code coll2} is not taken into account,
|
||||
* which is the same behavior as {@link Collection#containsAll(Collection)}.
|
||||
* <p>
|
||||
* In other words, this method returns <code>true</code> iff the
|
||||
* In other words, this method returns {@code true} iff the
|
||||
* {@link #intersection} of <i>coll1</i> and <i>coll2</i> has the same cardinality as
|
||||
* the set of unique values from {@code coll2}. In case {@code coll2} is empty, {@code true}
|
||||
* will be returned.
|
||||
|
@ -374,7 +374,7 @@ public class CollectionUtils {
|
|||
*
|
||||
* @param coll1 the first collection, must not be null
|
||||
* @param coll2 the second collection, must not be null
|
||||
* @return <code>true</code> iff the intersection of the collections has the same cardinality
|
||||
* @return {@code true} iff the intersection of the collections has the same cardinality
|
||||
* as the set of unique elements from the second collection
|
||||
* @since 4.0
|
||||
*/
|
||||
|
@ -407,16 +407,16 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff at least one element is in both collections.
|
||||
* Returns {@code true} iff at least one element is in both collections.
|
||||
* <p>
|
||||
* In other words, this method returns <code>true</code> iff the
|
||||
* In other words, this method returns {@code true} iff the
|
||||
* {@link #intersection} of <i>coll1</i> and <i>coll2</i> is not empty.
|
||||
* </p>
|
||||
*
|
||||
* @param <T> the type of object to lookup in <code>coll1</code>.
|
||||
* @param <T> the type of object to lookup in {@code coll1}.
|
||||
* @param coll1 the first collection, must not be null
|
||||
* @param coll2 the second collection, must not be null
|
||||
* @return <code>true</code> iff the intersection of the collections is non-empty
|
||||
* @return {@code true} iff the intersection of the collections is non-empty
|
||||
* @since 4.2
|
||||
* @see #intersection
|
||||
*/
|
||||
|
@ -438,15 +438,15 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff at least one element is in both collections.
|
||||
* Returns {@code true} iff at least one element is in both collections.
|
||||
* <p>
|
||||
* In other words, this method returns <code>true</code> iff the
|
||||
* In other words, this method returns {@code true} iff the
|
||||
* {@link #intersection} of <i>coll1</i> and <i>coll2</i> is not empty.
|
||||
* </p>
|
||||
*
|
||||
* @param coll1 the first collection, must not be null
|
||||
* @param coll2 the second collection, must not be null
|
||||
* @return <code>true</code> iff the intersection of the collections is non-empty
|
||||
* @return {@code true} iff the intersection of the collections is non-empty
|
||||
* @since 2.1
|
||||
* @see #intersection
|
||||
*/
|
||||
|
@ -501,7 +501,7 @@ public class CollectionUtils {
|
|||
*
|
||||
* @param a the first (sub?) collection, must not be null
|
||||
* @param b the second (super?) collection, must not be null
|
||||
* @return <code>true</code> iff <i>a</i> is a sub-collection of <i>b</i>
|
||||
* @return {@code true} iff <i>a</i> is a sub-collection of <i>b</i>
|
||||
* @see #isProperSubCollection
|
||||
* @see Collection#containsAll
|
||||
*/
|
||||
|
@ -526,14 +526,14 @@ public class CollectionUtils {
|
|||
* The implementation assumes
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li><code>a.size()</code> and <code>b.size()</code> represent the
|
||||
* <li>{@code a.size()} and {@code b.size()} represent the
|
||||
* total cardinality of <i>a</i> and <i>b</i>, resp. </li>
|
||||
* <li><code>a.size() < Integer.MAXVALUE</code></li>
|
||||
* <li>{@code a.size() < Integer.MAXVALUE}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param a the first (sub?) collection, must not be null
|
||||
* @param b the second (super?) collection, must not be null
|
||||
* @return <code>true</code> iff <i>a</i> is a <i>proper</i> sub-collection of <i>b</i>
|
||||
* @return {@code true} iff <i>a</i> is a <i>proper</i> sub-collection of <i>b</i>
|
||||
* @see #isSubCollection
|
||||
* @see Collection#containsAll
|
||||
*/
|
||||
|
@ -552,7 +552,7 @@ public class CollectionUtils {
|
|||
*
|
||||
* @param a the first collection, must not be null
|
||||
* @param b the second collection, must not be null
|
||||
* @return <code>true</code> iff the collections contain the same elements with the same cardinalities.
|
||||
* @return {@code true} iff the collections contain the same elements with the same cardinalities.
|
||||
*/
|
||||
public static boolean isEqualCollection(final Collection<?> a, final Collection<?> b) {
|
||||
if(a.size() != b.size()) {
|
||||
|
@ -589,7 +589,7 @@ public class CollectionUtils {
|
|||
* @param a the first collection, must not be null
|
||||
* @param b the second collection, must not be null
|
||||
* @param equator the Equator used for testing equality
|
||||
* @return <code>true</code> iff the collections contain the same elements with the same cardinalities.
|
||||
* @return {@code true} iff the collections contain the same elements with the same cardinalities.
|
||||
* @throws NullPointerException if the equator is null
|
||||
* @since 4.0
|
||||
*/
|
||||
|
@ -792,7 +792,7 @@ public class CollectionUtils {
|
|||
* Filter the collection by applying a Predicate to each element. If the
|
||||
* predicate returns true, remove the element.
|
||||
* <p>
|
||||
* This is equivalent to <code>filter(collection, PredicateUtils.notPredicate(predicate))</code>
|
||||
* This is equivalent to {@code filter(collection, PredicateUtils.notPredicate(predicate))}
|
||||
* if predicate is != null.
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -849,7 +849,7 @@ public class CollectionUtils {
|
|||
* Counts the number of elements in the input collection that match the
|
||||
* predicate.
|
||||
* <p>
|
||||
* A <code>null</code> collection or predicate matches no elements.
|
||||
* A {@code null} collection or predicate matches no elements.
|
||||
* </p>
|
||||
*
|
||||
* @param <C> the type of object the {@link Iterable} contains
|
||||
|
@ -867,7 +867,7 @@ public class CollectionUtils {
|
|||
* Answers true if a predicate is true for at least one element of a
|
||||
* collection.
|
||||
* <p>
|
||||
* A <code>null</code> collection or predicate returns false.
|
||||
* A {@code null} collection or predicate returns false.
|
||||
* </p>
|
||||
*
|
||||
* @param <C> the type of object the {@link Iterable} contains
|
||||
|
@ -886,10 +886,10 @@ public class CollectionUtils {
|
|||
* collection.
|
||||
*
|
||||
* <p>
|
||||
* A <code>null</code> predicate returns false.
|
||||
* A {@code null} predicate returns false.
|
||||
* </p>
|
||||
* <p>
|
||||
* A <code>null</code> or empty collection returns true.
|
||||
* A {@code null} or empty collection returns true.
|
||||
* </p>
|
||||
*
|
||||
* @param <C> the type of object the {@link Iterable} contains
|
||||
|
@ -909,7 +909,7 @@ public class CollectionUtils {
|
|||
* Selects all elements from input collection which match the given
|
||||
* predicate into an output collection.
|
||||
* <p>
|
||||
* A <code>null</code> predicate matches no elements.
|
||||
* A {@code null} predicate matches no elements.
|
||||
* </p>
|
||||
*
|
||||
* @param <O> the type of object the {@link Iterable} contains
|
||||
|
@ -958,12 +958,12 @@ public class CollectionUtils {
|
|||
* Selects all elements from inputCollection into an output and rejected collection,
|
||||
* based on the evaluation of the given predicate.
|
||||
* <p>
|
||||
* Elements matching the predicate are added to the <code>outputCollection</code>,
|
||||
* all other elements are added to the <code>rejectedCollection</code>.
|
||||
* Elements matching the predicate are added to the {@code outputCollection},
|
||||
* all other elements are added to the {@code rejectedCollection}.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the input predicate is <code>null</code>, no elements are added to
|
||||
* <code>outputCollection</code> or <code>rejectedCollection</code>.
|
||||
* If the input predicate is {@code null}, no elements are added to
|
||||
* {@code outputCollection} or {@code rejectedCollection}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Note: calling the method is equivalent to the following code snippet:
|
||||
|
@ -1003,7 +1003,7 @@ public class CollectionUtils {
|
|||
* Selects all elements from inputCollection which don't match the given
|
||||
* predicate into an output collection.
|
||||
* <p>
|
||||
* If the input predicate is <code>null</code>, the result is an empty
|
||||
* If the input predicate is {@code null}, the result is an empty
|
||||
* list.
|
||||
* </p>
|
||||
*
|
||||
|
@ -1024,8 +1024,8 @@ public class CollectionUtils {
|
|||
* Selects all elements from inputCollection which don't match the given
|
||||
* predicate and adds them to outputCollection.
|
||||
* <p>
|
||||
* If the input predicate is <code>null</code>, no elements are added to
|
||||
* <code>outputCollection</code>.
|
||||
* If the input predicate is {@code null}, no elements are added to
|
||||
* {@code outputCollection}.
|
||||
* </p>
|
||||
*
|
||||
* @param <O> the type of object the {@link Iterable} contains
|
||||
|
@ -1232,11 +1232,11 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th value in {@link Iterator}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code index}-th value in {@link Iterator}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* <p>
|
||||
* The Iterator is advanced to <code>index</code> (or to the end, if
|
||||
* <code>index</code> exceeds the number of entries) as a side effect of this method.
|
||||
* The Iterator is advanced to {@code index} (or to the end, if
|
||||
* {@code index} exceeds the number of entries) as a side effect of this method.
|
||||
* </p>
|
||||
*
|
||||
* @param iterator the iterator to get a value from
|
||||
|
@ -1264,8 +1264,8 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th value in the <code>iterable</code>'s {@link Iterator}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code index}-th value in the {@code iterable}'s {@link Iterator}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* <p>
|
||||
* If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
|
||||
* </p>
|
||||
|
@ -1283,27 +1283,27 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th value in <code>object</code>, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element or
|
||||
* <code>IllegalArgumentException</code> if <code>object</code> is not an
|
||||
* Returns the {@code index}-th value in {@code object}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element or
|
||||
* {@code IllegalArgumentException} if {@code object} is not an
|
||||
* instance of one of the supported types.
|
||||
* <p>
|
||||
* The supported types, and associated semantics are:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li> Map -- the value returned is the <code>Map.Entry</code> in position
|
||||
* <code>index</code> in the map's <code>entrySet</code> iterator,
|
||||
* <li> Map -- the value returned is the {@code Map.Entry} in position
|
||||
* {@code index} in the map's {@code entrySet} iterator,
|
||||
* if there is such an entry.</li>
|
||||
* <li> List -- this method is equivalent to the list's get method.</li>
|
||||
* <li> Array -- the <code>index</code>-th array entry is returned,
|
||||
* if there is such an entry; otherwise an <code>IndexOutOfBoundsException</code>
|
||||
* <li> Array -- the {@code index}-th array entry is returned,
|
||||
* if there is such an entry; otherwise an {@code IndexOutOfBoundsException}
|
||||
* is thrown.</li>
|
||||
* <li> Collection -- the value returned is the <code>index</code>-th object
|
||||
* <li> Collection -- the value returned is the {@code index}-th object
|
||||
* returned by the collection's default iterator, if there is such an element.</li>
|
||||
* <li> Iterator or Enumeration -- the value returned is the
|
||||
* <code>index</code>-th object in the Iterator/Enumeration, if there
|
||||
* {@code index}-th object in the Iterator/Enumeration, if there
|
||||
* is such an element. The Iterator/Enumeration is advanced to
|
||||
* <code>index</code> (or to the end, if <code>index</code> exceeds the
|
||||
* {@code index} (or to the end, if {@code index} exceeds the
|
||||
* number of entries) as a side effect of this method.</li>
|
||||
* </ul>
|
||||
*
|
||||
|
@ -1345,8 +1345,8 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th <code>Map.Entry</code> in the <code>map</code>'s <code>entrySet</code>,
|
||||
* throwing <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code index}-th {@code Map.Entry} in the {@code map}'s {@code entrySet},
|
||||
* throwing {@code IndexOutOfBoundsException} if there is no such element.
|
||||
*
|
||||
* @param <K> the key type in the {@link Map}
|
||||
* @param <V> the key type in the {@link Map}
|
||||
|
@ -1708,25 +1708,25 @@ public class CollectionUtils {
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a collection containing all the elements in <code>collection</code>
|
||||
* that are also in <code>retain</code>. The cardinality of an element <code>e</code>
|
||||
* in the returned collection is the same as the cardinality of <code>e</code>
|
||||
* in <code>collection</code> unless <code>retain</code> does not contain <code>e</code>, in which
|
||||
* Returns a collection containing all the elements in {@code collection}
|
||||
* that are also in {@code retain}. The cardinality of an element {@code e}
|
||||
* in the returned collection is the same as the cardinality of {@code e}
|
||||
* in {@code collection} unless {@code retain} does not contain {@code e}, in which
|
||||
* case the cardinality is zero. This method is useful if you do not wish to modify
|
||||
* the collection <code>c</code> and thus cannot call <code>c.retainAll(retain);</code>.
|
||||
* the collection {@code c} and thus cannot call {@code c.retainAll(retain);}.
|
||||
* <p>
|
||||
* This implementation iterates over <code>collection</code>, checking each element in
|
||||
* turn to see if it's contained in <code>retain</code>. If it's contained, it's added
|
||||
* This implementation iterates over {@code collection}, checking each element in
|
||||
* turn to see if it's contained in {@code retain}. If it's contained, it's added
|
||||
* to the returned list. As a consequence, it is advised to use a collection type for
|
||||
* <code>retain</code> that provides a fast (e.g. O(1)) implementation of
|
||||
* {@code retain} that provides a fast (e.g. O(1)) implementation of
|
||||
* {@link Collection#contains(Object)}.
|
||||
* </p>
|
||||
*
|
||||
* @param <C> the type of object the {@link Collection} contains
|
||||
* @param collection the collection whose contents are the target of the #retailAll operation
|
||||
* @param retain the collection containing the elements to be retained in the returned collection
|
||||
* @return a <code>Collection</code> containing all the elements of <code>collection</code>
|
||||
* that occur at least once in <code>retain</code>.
|
||||
* @return a {@code Collection} containing all the elements of {@code collection}
|
||||
* that occur at least once in {@code retain}.
|
||||
* @throws NullPointerException if either parameter is null
|
||||
* @since 3.2
|
||||
*/
|
||||
|
@ -1736,17 +1736,17 @@ public class CollectionUtils {
|
|||
|
||||
/**
|
||||
* Returns a collection containing all the elements in
|
||||
* <code>collection</code> that are also in <code>retain</code>. The
|
||||
* cardinality of an element <code>e</code> in the returned collection is
|
||||
* the same as the cardinality of <code>e</code> in <code>collection</code>
|
||||
* unless <code>retain</code> does not contain <code>e</code>, in which case
|
||||
* {@code collection} that are also in {@code retain}. The
|
||||
* cardinality of an element {@code e} in the returned collection is
|
||||
* the same as the cardinality of {@code e} in {@code collection}
|
||||
* unless {@code retain} does not contain {@code e}, in which case
|
||||
* the cardinality is zero. This method is useful if you do not wish to
|
||||
* modify the collection <code>c</code> and thus cannot call
|
||||
* <code>c.retainAll(retain);</code>.
|
||||
* modify the collection {@code c} and thus cannot call
|
||||
* {@code c.retainAll(retain);}.
|
||||
* <p>
|
||||
* Moreover this method uses an {@link Equator} instead of
|
||||
* {@link Object#equals(Object)} to determine the equality of the elements
|
||||
* in <code>collection</code> and <code>retain</code>. Hence this method is
|
||||
* in {@code collection} and {@code retain}. Hence this method is
|
||||
* useful in cases where the equals behavior of an object needs to be
|
||||
* modified without changing the object itself.
|
||||
* </p>
|
||||
|
@ -1755,8 +1755,8 @@ public class CollectionUtils {
|
|||
* @param collection the collection whose contents are the target of the {@code retainAll} operation
|
||||
* @param retain the collection containing the elements to be retained in the returned collection
|
||||
* @param equator the Equator used for testing equality
|
||||
* @return a <code>Collection</code> containing all the elements of <code>collection</code>
|
||||
* that occur at least once in <code>retain</code> according to the <code>equator</code>
|
||||
* @return a {@code Collection} containing all the elements of {@code collection}
|
||||
* that occur at least once in {@code retain} according to the {@code equator}
|
||||
* @throws NullPointerException if any of the parameters is null
|
||||
* @since 4.1
|
||||
*/
|
||||
|
@ -1845,26 +1845,26 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes the elements in <code>remove</code> from <code>collection</code>. That is, this
|
||||
* method returns a collection containing all the elements in <code>c</code>
|
||||
* that are not in <code>remove</code>. The cardinality of an element <code>e</code>
|
||||
* in the returned collection is the same as the cardinality of <code>e</code>
|
||||
* in <code>collection</code> unless <code>remove</code> contains <code>e</code>, in which
|
||||
* Removes the elements in {@code remove} from {@code collection}. That is, this
|
||||
* method returns a collection containing all the elements in {@code c}
|
||||
* that are not in {@code remove}. The cardinality of an element {@code e}
|
||||
* in the returned collection is the same as the cardinality of {@code e}
|
||||
* in {@code collection} unless {@code remove} contains {@code e}, in which
|
||||
* case the cardinality is zero. This method is useful if you do not wish to modify
|
||||
* the collection <code>c</code> and thus cannot call <code>collection.removeAll(remove);</code>.
|
||||
* the collection {@code c} and thus cannot call {@code collection.removeAll(remove);}.
|
||||
* <p>
|
||||
* This implementation iterates over <code>collection</code>, checking each element in
|
||||
* turn to see if it's contained in <code>remove</code>. If it's not contained, it's added
|
||||
* This implementation iterates over {@code collection}, checking each element in
|
||||
* turn to see if it's contained in {@code remove}. If it's not contained, it's added
|
||||
* to the returned list. As a consequence, it is advised to use a collection type for
|
||||
* <code>remove</code> that provides a fast (e.g. O(1)) implementation of
|
||||
* {@code remove} that provides a fast (e.g. O(1)) implementation of
|
||||
* {@link Collection#contains(Object)}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of object the {@link Collection} contains
|
||||
* @param collection the collection from which items are removed (in the returned collection)
|
||||
* @param remove the items to be removed from the returned <code>collection</code>
|
||||
* @return a <code>Collection</code> containing all the elements of <code>collection</code> except
|
||||
* any elements that also occur in <code>remove</code>.
|
||||
* @param remove the items to be removed from the returned {@code collection}
|
||||
* @return a {@code Collection} containing all the elements of {@code collection} except
|
||||
* any elements that also occur in {@code remove}.
|
||||
* @throws NullPointerException if either parameter is null
|
||||
* @since 4.0 (method existed in 3.2 but was completely broken)
|
||||
*/
|
||||
|
@ -1873,19 +1873,19 @@ public class CollectionUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes all elements in <code>remove</code> from <code>collection</code>.
|
||||
* Removes all elements in {@code remove} from {@code collection}.
|
||||
* That is, this method returns a collection containing all the elements in
|
||||
* <code>collection</code> that are not in <code>remove</code>. The
|
||||
* cardinality of an element <code>e</code> in the returned collection is
|
||||
* the same as the cardinality of <code>e</code> in <code>collection</code>
|
||||
* unless <code>remove</code> contains <code>e</code>, in which case the
|
||||
* {@code collection} that are not in {@code remove}. The
|
||||
* cardinality of an element {@code e} in the returned collection is
|
||||
* the same as the cardinality of {@code e} in {@code collection}
|
||||
* unless {@code remove} contains {@code e}, in which case the
|
||||
* cardinality is zero. This method is useful if you do not wish to modify
|
||||
* the collection <code>c</code> and thus cannot call
|
||||
* <code>collection.removeAll(remove)</code>.
|
||||
* the collection {@code c} and thus cannot call
|
||||
* {@code collection.removeAll(remove)}.
|
||||
* <p>
|
||||
* Moreover this method uses an {@link Equator} instead of
|
||||
* {@link Object#equals(Object)} to determine the equality of the elements
|
||||
* in <code>collection</code> and <code>remove</code>. Hence this method is
|
||||
* in {@code collection} and {@code remove}. Hence this method is
|
||||
* useful in cases where the equals behavior of an object needs to be
|
||||
* modified without changing the object itself.
|
||||
* </p>
|
||||
|
@ -1894,8 +1894,8 @@ public class CollectionUtils {
|
|||
* @param collection the collection from which items are removed (in the returned collection)
|
||||
* @param remove the items to be removed from the returned collection
|
||||
* @param equator the Equator used for testing equality
|
||||
* @return a <code>Collection</code> containing all the elements of <code>collection</code>
|
||||
* except any element that if equal according to the <code>equator</code>
|
||||
* @return a {@code Collection} containing all the elements of {@code collection}
|
||||
* except any element that if equal according to the {@code equator}
|
||||
* @throws NullPointerException if any of the parameters is null
|
||||
* @since 4.1
|
||||
*/
|
||||
|
|
|
@ -32,9 +32,9 @@ import org.apache.commons.collections4.comparators.TransformingComparator;
|
|||
* objects.
|
||||
* <p>
|
||||
* Most of the functionality in this class can also be found in the
|
||||
* <code>comparators</code> package. This class merely provides a
|
||||
* {@code comparators} package. This class merely provides a
|
||||
* convenient central place if you have use for more than one class
|
||||
* in the <code>comparators</code> subpackage.
|
||||
* in the {@code comparators} subpackage.
|
||||
* </p>
|
||||
*
|
||||
* @since 2.1
|
||||
|
@ -123,9 +123,9 @@ public class ComparatorUtils {
|
|||
* The comparator throws NullPointerException if a null value is compared.
|
||||
* </p>
|
||||
*
|
||||
* @param trueFirst when <code>true</code>, sort
|
||||
* <code>true</code> {@link Boolean}s before
|
||||
* <code>false</code> {@link Boolean}s.
|
||||
* @param trueFirst when {@code true}, sort
|
||||
* {@code true} {@link Boolean}s before
|
||||
* {@code false} {@link Boolean}s.
|
||||
* @return a comparator that sorts booleans
|
||||
*/
|
||||
public static Comparator<Boolean> booleanComparator(final boolean trueFirst) {
|
||||
|
@ -133,7 +133,7 @@ public class ComparatorUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a Comparator that controls the comparison of <code>null</code> values.
|
||||
* Gets a Comparator that controls the comparison of {@code null} values.
|
||||
* <p>
|
||||
* The returned comparator will consider a null value to be less than
|
||||
* any nonnull value, and equal to any other null value. Two nonnull
|
||||
|
@ -154,7 +154,7 @@ public class ComparatorUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a Comparator that controls the comparison of <code>null</code> values.
|
||||
* Gets a Comparator that controls the comparison of {@code null} values.
|
||||
* <p>
|
||||
* The returned comparator will consider a null value to be greater than
|
||||
* any nonnull value, and equal to any other null value. Two nonnull
|
||||
|
|
|
@ -36,11 +36,11 @@ public class EnumerationUtils {
|
|||
private EnumerationUtils() {}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th value in the {@link Enumeration}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code index}-th value in the {@link Enumeration}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* <p>
|
||||
* The Enumeration is advanced to <code>index</code> (or to the end, if
|
||||
* <code>index</code> exceeds the number of entries) as a side effect of this method.
|
||||
* The Enumeration is advanced to {@code index} (or to the end, if
|
||||
* {@code index} exceeds the number of entries) as a side effect of this method.
|
||||
*
|
||||
* @param e the enumeration to get a value from
|
||||
* @param index the index to get
|
||||
|
@ -70,9 +70,9 @@ public class EnumerationUtils {
|
|||
* created. The new list is returned.</p>
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param enumeration the enumeration to traverse, which should not be <code>null</code>.
|
||||
* @param enumeration the enumeration to traverse, which should not be {@code null}.
|
||||
* @return a list containing all elements of the given enumeration
|
||||
* @throws NullPointerException if the enumeration parameter is <code>null</code>.
|
||||
* @throws NullPointerException if the enumeration parameter is {@code null}.
|
||||
*/
|
||||
public static <E> List<E> toList(final Enumeration<? extends E> enumeration) {
|
||||
return IteratorUtils.toList(new EnumerationIterator<>(enumeration));
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.commons.collections4;
|
|||
/**
|
||||
* Defines a functor interface implemented by classes that create objects.
|
||||
* <p>
|
||||
* A <code>Factory</code> creates an object without using an input parameter.
|
||||
* A {@code Factory} creates an object without using an input parameter.
|
||||
* If an input parameter is required, then {@link Transformer} is more appropriate.
|
||||
* </p>
|
||||
* <p>
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.collections4.functors.InstantiateFactory;
|
|||
import org.apache.commons.collections4.functors.PrototypeFactory;
|
||||
|
||||
/**
|
||||
* <code>FactoryUtils</code> provides reference implementations and utilities
|
||||
* {@code FactoryUtils} provides reference implementations and utilities
|
||||
* for the Factory functor interface. The supplied factories are:
|
||||
* <ul>
|
||||
* <li>Prototype - clones a specified object
|
||||
|
@ -83,7 +83,7 @@ public class FactoryUtils {
|
|||
*
|
||||
* @param <T> the type that the factory creates
|
||||
* @param constantToReturn the constant object to return each time in the factory
|
||||
* @return the <code>constant</code> factory.
|
||||
* @return the {@code constant} factory.
|
||||
*/
|
||||
public static <T> Factory<T> constantFactory(final T constantToReturn) {
|
||||
return ConstantFactory.constantFactory(constantToReturn);
|
||||
|
@ -104,7 +104,7 @@ public class FactoryUtils {
|
|||
*
|
||||
* @param <T> the type that the factory creates
|
||||
* @param prototype the object to clone each time in the factory
|
||||
* @return the <code>prototype</code> factory, or a {@link ConstantFactory#NULL_INSTANCE} if
|
||||
* @return the {@code prototype} factory, or a {@link ConstantFactory#NULL_INSTANCE} if
|
||||
* the {@code prototype} is {@code null}
|
||||
* @throws IllegalArgumentException if the prototype cannot be cloned
|
||||
*/
|
||||
|
@ -120,7 +120,7 @@ public class FactoryUtils {
|
|||
*
|
||||
* @param <T> the type that the factory creates
|
||||
* @param classToInstantiate the Class to instantiate each time in the factory
|
||||
* @return the <code>reflection</code> factory
|
||||
* @return the {@code reflection} factory
|
||||
* @throws NullPointerException if the classToInstantiate is null
|
||||
*/
|
||||
public static <T> Factory<T> instantiateFactory(final Class<T> classToInstantiate) {
|
||||
|
@ -137,7 +137,7 @@ public class FactoryUtils {
|
|||
* @param classToInstantiate the Class to instantiate each time in the factory
|
||||
* @param paramTypes parameter types for the constructor, can be null
|
||||
* @param args the arguments to pass to the constructor, can be null
|
||||
* @return the <code>reflection</code> factory
|
||||
* @return the {@code reflection} factory
|
||||
* @throws NullPointerException if the classToInstantiate is null
|
||||
* @throws IllegalArgumentException if the paramTypes and args don't match
|
||||
* @throws IllegalArgumentException if the constructor doesn't exist
|
||||
|
|
|
@ -380,7 +380,7 @@ public class FluentIterable<E> implements Iterable<E> {
|
|||
* Checks if all elements contained in this iterable are matching the
|
||||
* provided predicate.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns true.
|
||||
* A {@code null} or empty iterable returns true.
|
||||
*
|
||||
* @param predicate the predicate to use, may not be null
|
||||
* @return true if all elements contained in this iterable match the predicate,
|
||||
|
@ -394,7 +394,7 @@ public class FluentIterable<E> implements Iterable<E> {
|
|||
/**
|
||||
* Checks if this iterable contains any element matching the provided predicate.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns false.
|
||||
* A {@code null} or empty iterable returns false.
|
||||
*
|
||||
* @param predicate the predicate to use, may not be null
|
||||
* @return true if at least one element contained in this iterable matches the predicate,
|
||||
|
|
|
@ -28,7 +28,7 @@ public class FunctorException extends RuntimeException {
|
|||
private static final long serialVersionUID = -4704772662059351193L;
|
||||
|
||||
/**
|
||||
* Constructs a new <code>FunctorException</code> without specified
|
||||
* Constructs a new {@code FunctorException} without specified
|
||||
* detail message.
|
||||
*/
|
||||
public FunctorException() {
|
||||
|
@ -36,7 +36,7 @@ public class FunctorException extends RuntimeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>FunctorException</code> with specified
|
||||
* Constructs a new {@code FunctorException} with specified
|
||||
* detail message.
|
||||
*
|
||||
* @param msg the error message.
|
||||
|
@ -46,8 +46,8 @@ public class FunctorException extends RuntimeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>FunctorException</code> with specified
|
||||
* nested <code>Throwable</code> root cause.
|
||||
* Constructs a new {@code FunctorException} with specified
|
||||
* nested {@code Throwable} root cause.
|
||||
*
|
||||
* @param rootCause the exception or error that caused this exception
|
||||
* to be thrown.
|
||||
|
@ -57,8 +57,8 @@ public class FunctorException extends RuntimeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>FunctorException</code> with specified
|
||||
* detail message and nested <code>Throwable</code> root cause.
|
||||
* Constructs a new {@code FunctorException} with specified
|
||||
* detail message and nested {@code Throwable} root cause.
|
||||
*
|
||||
* @param msg the error message.
|
||||
* @param rootCause the exception or error that caused this exception
|
||||
|
|
|
@ -32,7 +32,7 @@ public interface Get<K, V> {
|
|||
|
||||
/**
|
||||
* @param key key whose presence in this map is to be tested
|
||||
* @return <code>true</code> if this map contains a mapping for the specified
|
||||
* @return {@code true} if this map contains a mapping for the specified
|
||||
* key
|
||||
* @see java.util.Map#containsKey(Object)
|
||||
*/
|
||||
|
@ -40,7 +40,7 @@ public interface Get<K, V> {
|
|||
|
||||
/**
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return <code>true</code> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified value
|
||||
* @see java.util.Map#containsValue(Object)
|
||||
*/
|
||||
|
@ -62,14 +62,14 @@ public interface Get<K, V> {
|
|||
|
||||
/**
|
||||
* @param key key whose mapping is to be removed from the map
|
||||
* @return the previous value associated with <code>key</code>, or
|
||||
* <code>null</code> if there was no mapping for <code>key</code>.
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* @see java.util.Map#remove(Object)
|
||||
*/
|
||||
V remove(Object key);
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if this map contains no key-value mappings
|
||||
* @return {@code true} if this map contains no key-value mappings
|
||||
* @see java.util.Map#isEmpty()
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.apache.commons.collections4;
|
|||
*/
|
||||
public interface IterableGet<K, V> extends Get<K, V> {
|
||||
/**
|
||||
* Obtains a <code>MapIterator</code> over the map.
|
||||
* Obtains a {@code MapIterator} over the map.
|
||||
* <p>
|
||||
* A map iterator is an efficient way of iterating over maps.
|
||||
* There is no need to access the entry set or use Map Entry objects.
|
||||
|
|
|
@ -599,7 +599,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Finds the first element in the given iterable which matches the given predicate.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns null.
|
||||
* A {@code null} or empty iterator returns null.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterable the iterable to search, may be null
|
||||
|
@ -615,7 +615,7 @@ public class IterableUtils {
|
|||
* Returns the index of the first element in the specified iterable that
|
||||
* matches the given predicate.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns -1.
|
||||
* A {@code null} or empty iterable returns -1.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterable the iterable to search, may be null
|
||||
|
@ -630,7 +630,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Answers true if a predicate is true for every element of an iterable.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns true.
|
||||
* A {@code null} or empty iterable returns true.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterable} contains
|
||||
* @param iterable the {@link Iterable} to use, may be null
|
||||
|
@ -646,7 +646,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Answers true if a predicate is true for any element of the iterable.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns false.
|
||||
* A {@code null} or empty iterable returns false.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterable} contains
|
||||
* @param iterable the {@link Iterable} to use, may be null
|
||||
|
@ -661,7 +661,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Counts the number of elements in the input iterable that match the predicate.
|
||||
* <p>
|
||||
* A <code>null</code> iterable matches no elements.
|
||||
* A {@code null} iterable matches no elements.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterable} contains
|
||||
* @param input the {@link Iterable} to get the input from, may be null
|
||||
|
@ -677,7 +677,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Answers true if the provided iterable is empty.
|
||||
* <p>
|
||||
* A <code>null</code> iterable returns true.
|
||||
* A {@code null} iterable returns true.
|
||||
*
|
||||
* @param iterable the {@link Iterable to use}, may be null
|
||||
* @return true if the iterable is null or empty, false otherwise
|
||||
|
@ -692,7 +692,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Checks if the object is contained in the given iterable.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns false.
|
||||
* A {@code null} or empty iterable returns false.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterable} contains
|
||||
* @param iterable the iterable to check, may be null
|
||||
|
@ -711,8 +711,8 @@ public class IterableUtils {
|
|||
* is tested with an {@code equator} unlike {@link #contains(Iterable, Object)}
|
||||
* which uses {@link Object#equals(Object)}.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterable returns false.
|
||||
* A <code>null</code> object will not be passed to the equator, instead a
|
||||
* A {@code null} or empty iterable returns false.
|
||||
* A {@code null} object will not be passed to the equator, instead a
|
||||
* {@link org.apache.commons.collections4.functors.NullPredicate NullPredicate}
|
||||
* will be used.
|
||||
*
|
||||
|
@ -749,8 +749,8 @@ public class IterableUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th value in the <code>iterable</code>'s {@link Iterator}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code index}-th value in the {@code iterable}'s {@link Iterator}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* <p>
|
||||
* If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
|
||||
*
|
||||
|
@ -771,8 +771,8 @@ public class IterableUtils {
|
|||
/**
|
||||
* Shortcut for {@code get(iterator, 0)}.
|
||||
* <p>
|
||||
* Returns the <code>first</code> value in the <code>iterable</code>'s {@link Iterator}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code first} value in the {@code iterable}'s {@link Iterator}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
|
||||
|
@ -791,7 +791,7 @@ public class IterableUtils {
|
|||
/**
|
||||
* Returns the number of elements contained in the given iterator.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns {@code 0}.
|
||||
* A {@code null} or empty iterator returns {@code 0}.
|
||||
*
|
||||
* @param iterable the iterable to check, may be null
|
||||
* @return the number of elements contained in the iterable
|
||||
|
@ -818,7 +818,7 @@ public class IterableUtils {
|
|||
* R = collection of elements rejected by all predicates
|
||||
* </pre>
|
||||
* <p>
|
||||
* If the input iterable is <code>null</code>, the same is returned as for an
|
||||
* If the input iterable is {@code null}, the same is returned as for an
|
||||
* empty iterable.
|
||||
* <p>
|
||||
* Example: for an input list [1, 2, 3, 4, 5] calling partition with a predicate [x < 3]
|
||||
|
@ -860,7 +860,7 @@ public class IterableUtils {
|
|||
* <b>Note</b>: elements are only added to the output collection of the first matching
|
||||
* predicate, determined by the order of arguments.
|
||||
* <p>
|
||||
* If the input iterable is <code>null</code>, the same is returned as for an
|
||||
* If the input iterable is {@code null}, the same is returned as for an
|
||||
* empty iterable.
|
||||
* <p>
|
||||
* Example: for an input list [1, 2, 3, 4, 5] calling partition with predicates [x < 3]
|
||||
|
@ -900,7 +900,7 @@ public class IterableUtils {
|
|||
* <b>Note</b>: elements are only added to the output collection of the first matching
|
||||
* predicate, determined by the order of arguments.
|
||||
* <p>
|
||||
* If the input iterable is <code>null</code>, the same is returned as for an
|
||||
* If the input iterable is {@code null}, the same is returned as for an
|
||||
* empty iterable.
|
||||
* If no predicates have been provided, all elements of the input collection
|
||||
* will be added to the rejected collection.
|
||||
|
@ -1069,12 +1069,12 @@ public class IterableUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an empty iterator if the argument is <code>null</code>,
|
||||
* Returns an empty iterator if the argument is {@code null},
|
||||
* or {@code iterable.iterator()} otherwise.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterable the iterable, possibly <code>null</code>
|
||||
* @return an empty iterator if the argument is <code>null</code>
|
||||
* @param iterable the iterable, possibly {@code null}
|
||||
* @return an empty iterator if the argument is {@code null}
|
||||
*/
|
||||
private static <E> Iterator<E> emptyIteratorIfNull(final Iterable<E> iterable) {
|
||||
return iterable != null ? iterable.iterator() : IteratorUtils.<E>emptyIterator();
|
||||
|
|
|
@ -556,9 +556,9 @@ public class IteratorUtils {
|
|||
* Gets an iterator that provides an ordered iteration over the elements
|
||||
* contained in a collection of ordered {@link Iterator}s.
|
||||
* <p>
|
||||
* Given two ordered {@link Iterator}s <code>A</code> and <code>B</code>,
|
||||
* Given two ordered {@link Iterator}s {@code A} and {@code B},
|
||||
* the {@link Iterator#next()} method will return the lesser of
|
||||
* <code>A.next()</code> and <code>B.next()</code>.
|
||||
* {@code A.next()} and {@code B.next()}.
|
||||
* <p>
|
||||
* The comparator is optional. If null is specified then natural order is used.
|
||||
*
|
||||
|
@ -582,9 +582,9 @@ public class IteratorUtils {
|
|||
* Gets an iterator that provides an ordered iteration over the elements
|
||||
* contained in an array of {@link Iterator}s.
|
||||
* <p>
|
||||
* Given two ordered {@link Iterator}s <code>A</code> and <code>B</code>,
|
||||
* Given two ordered {@link Iterator}s {@code A} and {@code B},
|
||||
* the {@link Iterator#next()} method will return the lesser of
|
||||
* <code>A.next()</code> and <code>B.next()</code> and so on.
|
||||
* {@code A.next()} and {@code B.next()} and so on.
|
||||
* <p>
|
||||
* The comparator is optional. If null is specified then natural order is used.
|
||||
*
|
||||
|
@ -606,9 +606,9 @@ public class IteratorUtils {
|
|||
* Gets an iterator that provides an ordered iteration over the elements
|
||||
* contained in a collection of {@link Iterator}s.
|
||||
* <p>
|
||||
* Given two ordered {@link Iterator}s <code>A</code> and <code>B</code>,
|
||||
* Given two ordered {@link Iterator}s {@code A} and {@code B},
|
||||
* the {@link Iterator#next()} method will return the lesser of
|
||||
* <code>A.next()</code> and <code>B.next()</code> and so on.
|
||||
* {@code A.next()} and {@code B.next()} and so on.
|
||||
* <p>
|
||||
* The comparator is optional. If null is specified then natural order is used.
|
||||
*
|
||||
|
@ -634,8 +634,8 @@ public class IteratorUtils {
|
|||
* <p>
|
||||
* This iterator can extract multiple objects from a complex tree-like object graph.
|
||||
* The iteration starts from a single root object.
|
||||
* It uses a <code>Transformer</code> to extract the iterators and elements.
|
||||
* Its main benefit is that no intermediate <code>List</code> is created.
|
||||
* It uses a {@code Transformer} to extract the iterators and elements.
|
||||
* Its main benefit is that no intermediate {@code List} is created.
|
||||
* <p>
|
||||
* For example, consider an object graph:
|
||||
* <pre>
|
||||
|
@ -649,7 +649,7 @@ public class IteratorUtils {
|
|||
* |- Tree | /- Leaf
|
||||
* |- Branch -- Leaf
|
||||
* |- Branch -- Leaf</pre>
|
||||
* The following <code>Transformer</code>, used in this class, will extract all
|
||||
* The following {@code Transformer}, used in this class, will extract all
|
||||
* the Leaf objects without creating a combined intermediate list:
|
||||
* <pre>
|
||||
* public Object transform(Object input) {
|
||||
|
@ -1207,7 +1207,7 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Finds the first element in the given iterator which matches the given predicate.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns null.
|
||||
* A {@code null} or empty iterator returns null.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterator the iterator to search, may be null
|
||||
|
@ -1234,7 +1234,7 @@ public class IteratorUtils {
|
|||
* Returns the index of the first element in the specified iterator that
|
||||
* matches the given predicate.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns -1.
|
||||
* A {@code null} or empty iterator returns -1.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterator the iterator to search, may be null
|
||||
|
@ -1260,7 +1260,7 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Answers true if a predicate is true for any element of the iterator.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns false.
|
||||
* A {@code null} or empty iterator returns false.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterator} contains
|
||||
* @param iterator the {@link Iterator} to use, may be null
|
||||
|
@ -1276,7 +1276,7 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Answers true if a predicate is true for every element of an iterator.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns true.
|
||||
* A {@code null} or empty iterator returns true.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterator} contains
|
||||
* @param iterator the {@link Iterator} to use, may be null
|
||||
|
@ -1303,7 +1303,7 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Checks if the given iterator is empty.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns true.
|
||||
* A {@code null} or empty iterator returns true.
|
||||
*
|
||||
* @param iterator the {@link Iterator} to use, may be null
|
||||
* @return true if the iterator is exhausted or null, false otherwise
|
||||
|
@ -1316,7 +1316,7 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Checks if the object is contained in the given iterator.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns false.
|
||||
* A {@code null} or empty iterator returns false.
|
||||
*
|
||||
* @param <E> the type of object the {@link Iterator} contains
|
||||
* @param iterator the iterator to check, may be null
|
||||
|
@ -1329,11 +1329,11 @@ public class IteratorUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>index</code>-th value in {@link Iterator}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code index}-th value in {@link Iterator}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* <p>
|
||||
* The Iterator is advanced to <code>index</code> (or to the end, if
|
||||
* <code>index</code> exceeds the number of entries) as a side effect of this method.
|
||||
* The Iterator is advanced to {@code index} (or to the end, if
|
||||
* {@code index} exceeds the number of entries) as a side effect of this method.
|
||||
*
|
||||
* @param <E> the type of object in the {@link Iterator}
|
||||
* @param iterator the iterator to get a value from
|
||||
|
@ -1358,12 +1358,12 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Shortcut for {@code get(iterator, 0)}.
|
||||
* <p>
|
||||
* Returns the <code>first</code> value in {@link Iterator}, throwing
|
||||
* <code>IndexOutOfBoundsException</code> if there is no such element.
|
||||
* Returns the {@code first} value in {@link Iterator}, throwing
|
||||
* {@code IndexOutOfBoundsException} if there is no such element.
|
||||
* </p>
|
||||
* <p>
|
||||
* The Iterator is advanced to <code>0</code> (or to the end, if
|
||||
* <code>0</code> exceeds the number of entries) as a side effect of this method.
|
||||
* The Iterator is advanced to {@code 0} (or to the end, if
|
||||
* {@code 0} exceeds the number of entries) as a side effect of this method.
|
||||
* </p>
|
||||
* @param <E> the type of object in the {@link Iterator}
|
||||
* @param iterator the iterator to get a value from
|
||||
|
@ -1378,7 +1378,7 @@ public class IteratorUtils {
|
|||
/**
|
||||
* Returns the number of elements contained in the given iterator.
|
||||
* <p>
|
||||
* A <code>null</code> or empty iterator returns {@code 0}.
|
||||
* A {@code null} or empty iterator returns {@code 0}.
|
||||
*
|
||||
* @param iterator the iterator to check, may be null
|
||||
* @return the number of elements contained in the iterator
|
||||
|
|
|
@ -44,19 +44,19 @@ import org.apache.commons.collections4.sequence.SequencesComparator;
|
|||
public class ListUtils {
|
||||
|
||||
/**
|
||||
* <code>ListUtils</code> should not normally be instantiated.
|
||||
* {@code ListUtils} should not normally be instantiated.
|
||||
*/
|
||||
private ListUtils() {}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns an immutable empty list if the argument is <code>null</code>,
|
||||
* Returns an immutable empty list if the argument is {@code null},
|
||||
* or the argument itself otherwise.
|
||||
*
|
||||
* @param <T> the element type
|
||||
* @param list the list, possibly <code>null</code>
|
||||
* @return an empty list if the argument is <code>null</code>
|
||||
* @param list the list, possibly {@code null}
|
||||
* @return an empty list if the argument is {@code null}
|
||||
*/
|
||||
public static <T> List<T> emptyIfNull(final List<T> list) {
|
||||
return list == null ? Collections.<T>emptyList() : list;
|
||||
|
@ -69,7 +69,7 @@ public class ListUtils {
|
|||
* @param <T> the element type
|
||||
* @param list the list, possibly {@code null}
|
||||
* @param defaultList the returned values if list is {@code null}
|
||||
* @return an empty list if the argument is <code>null</code>
|
||||
* @return an empty list if the argument is {@code null}
|
||||
* @since 4.0
|
||||
*/
|
||||
public static <T> List<T> defaultIfNull(final List<T> list, final List<T> defaultList) {
|
||||
|
@ -170,7 +170,7 @@ public class ListUtils {
|
|||
* Selects all elements from input collection which match the given
|
||||
* predicate into an output list.
|
||||
* <p>
|
||||
* A <code>null</code> predicate matches no elements.
|
||||
* A {@code null} predicate matches no elements.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param inputCollection the collection to get the input from, may not be null
|
||||
|
@ -190,7 +190,7 @@ public class ListUtils {
|
|||
* Selects all elements from inputCollection which don't match the given
|
||||
* predicate into an output collection.
|
||||
* <p>
|
||||
* If the input predicate is <code>null</code>, the result is an empty list.
|
||||
* If the input predicate is {@code null}, the result is an empty list.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param inputCollection the collection to get the input from, may not be null
|
||||
|
@ -210,7 +210,7 @@ public class ListUtils {
|
|||
* Tests two lists for value-equality as per the equality contract in
|
||||
* {@link java.util.List#equals(java.lang.Object)}.
|
||||
* <p>
|
||||
* This method is useful for implementing <code>List</code> when you cannot
|
||||
* This method is useful for implementing {@code List} when you cannot
|
||||
* extend AbstractList. The method takes Collection instances to enable other
|
||||
* collection types to use the List implementation algorithm.
|
||||
* <p>
|
||||
|
@ -264,7 +264,7 @@ public class ListUtils {
|
|||
* Generates a hash code using the algorithm specified in
|
||||
* {@link java.util.List#hashCode()}.
|
||||
* <p>
|
||||
* This method is useful for implementing <code>List</code> when you cannot
|
||||
* This method is useful for implementing {@code List} when you cannot
|
||||
* extend AbstractList. The method takes Collection instances to enable other
|
||||
* collection types to use the List implementation algorithm.
|
||||
*
|
||||
|
@ -288,24 +288,24 @@ public class ListUtils {
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a List containing all the elements in <code>collection</code>
|
||||
* that are also in <code>retain</code>. The cardinality of an element <code>e</code>
|
||||
* in the returned list is the same as the cardinality of <code>e</code>
|
||||
* in <code>collection</code> unless <code>retain</code> does not contain <code>e</code>, in which
|
||||
* Returns a List containing all the elements in {@code collection}
|
||||
* that are also in {@code retain}. The cardinality of an element {@code e}
|
||||
* in the returned list is the same as the cardinality of {@code e}
|
||||
* in {@code collection} unless {@code retain} does not contain {@code e}, in which
|
||||
* case the cardinality is zero. This method is useful if you do not wish to modify
|
||||
* the collection <code>c</code> and thus cannot call <code>collection.retainAll(retain);</code>.
|
||||
* the collection {@code c} and thus cannot call {@code collection.retainAll(retain);}.
|
||||
* <p>
|
||||
* This implementation iterates over <code>collection</code>, checking each element in
|
||||
* turn to see if it's contained in <code>retain</code>. If it's contained, it's added
|
||||
* This implementation iterates over {@code collection}, checking each element in
|
||||
* turn to see if it's contained in {@code retain}. If it's contained, it's added
|
||||
* to the returned list. As a consequence, it is advised to use a collection type for
|
||||
* <code>retain</code> that provides a fast (e.g. O(1)) implementation of
|
||||
* {@code retain} that provides a fast (e.g. O(1)) implementation of
|
||||
* {@link Collection#contains(Object)}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param collection the collection whose contents are the target of the #retailAll operation
|
||||
* @param retain the collection containing the elements to be retained in the returned collection
|
||||
* @return a <code>List</code> containing all the elements of <code>c</code>
|
||||
* that occur at least once in <code>retain</code>.
|
||||
* @return a {@code List} containing all the elements of {@code c}
|
||||
* that occur at least once in {@code retain}.
|
||||
* @throws NullPointerException if either parameter is null
|
||||
* @since 3.2
|
||||
*/
|
||||
|
@ -321,25 +321,25 @@ public class ListUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes the elements in <code>remove</code> from <code>collection</code>. That is, this
|
||||
* method returns a list containing all the elements in <code>collection</code>
|
||||
* that are not in <code>remove</code>. The cardinality of an element <code>e</code>
|
||||
* in the returned collection is the same as the cardinality of <code>e</code>
|
||||
* in <code>collection</code> unless <code>remove</code> contains <code>e</code>, in which
|
||||
* Removes the elements in {@code remove} from {@code collection}. That is, this
|
||||
* method returns a list containing all the elements in {@code collection}
|
||||
* that are not in {@code remove}. The cardinality of an element {@code e}
|
||||
* in the returned collection is the same as the cardinality of {@code e}
|
||||
* in {@code collection} unless {@code remove} contains {@code e}, in which
|
||||
* case the cardinality is zero. This method is useful if you do not wish to modify
|
||||
* <code>collection</code> and thus cannot call <code>collection.removeAll(remove);</code>.
|
||||
* {@code collection} and thus cannot call {@code collection.removeAll(remove);}.
|
||||
* <p>
|
||||
* This implementation iterates over <code>collection</code>, checking each element in
|
||||
* turn to see if it's contained in <code>remove</code>. If it's not contained, it's added
|
||||
* This implementation iterates over {@code collection}, checking each element in
|
||||
* turn to see if it's contained in {@code remove}. If it's not contained, it's added
|
||||
* to the returned list. As a consequence, it is advised to use a collection type for
|
||||
* <code>remove</code> that provides a fast (e.g. O(1)) implementation of
|
||||
* {@code remove} that provides a fast (e.g. O(1)) implementation of
|
||||
* {@link Collection#contains(Object)}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param collection the collection from which items are removed (in the returned collection)
|
||||
* @param remove the items to be removed from the returned <code>collection</code>
|
||||
* @return a <code>List</code> containing all the elements of <code>c</code> except
|
||||
* any elements that also occur in <code>remove</code>.
|
||||
* @param remove the items to be removed from the returned {@code collection}
|
||||
* @return a {@code List} containing all the elements of {@code c} except
|
||||
* any elements that also occur in {@code remove}.
|
||||
* @throws NullPointerException if either parameter is null
|
||||
* @since 3.2
|
||||
*/
|
||||
|
@ -457,10 +457,10 @@ public class ListUtils {
|
|||
* Date date = lazy.get(3);
|
||||
* </pre>
|
||||
*
|
||||
* After the above code is executed, <code>date</code> will refer to
|
||||
* a new <code>Date</code> instance. Furthermore, that <code>Date</code>
|
||||
* After the above code is executed, {@code date} will refer to
|
||||
* a new {@code Date} instance. Furthermore, that {@code Date}
|
||||
* instance is the fourth element in the list. The first, second,
|
||||
* and third element are all set to <code>null</code>.
|
||||
* and third element are all set to {@code null}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param list the list to make lazy, must not be null
|
||||
|
@ -488,10 +488,10 @@ public class ListUtils {
|
|||
* Date date = lazy.get(3);
|
||||
* </pre>
|
||||
*
|
||||
* After the above code is executed, <code>date</code> will refer to
|
||||
* a new <code>Date</code> instance. Furthermore, that <code>Date</code>
|
||||
* After the above code is executed, {@code date} will refer to
|
||||
* a new {@code Date} instance. Furthermore, that {@code Date}
|
||||
* instance is the fourth element in the list. The first, second,
|
||||
* and third element are all set to <code>null</code>.
|
||||
* and third element are all set to {@code null}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param list the list to make lazy, must not be null
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.commons.collections4;
|
|||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Defines an iterator that operates over a <code>Map</code>.
|
||||
* Defines an iterator that operates over a {@code Map}.
|
||||
* <p>
|
||||
* This iterator is a special version designed for maps. It can be more
|
||||
* efficient to use this rather than an entry set iterator where the option
|
||||
|
@ -31,8 +31,8 @@ import java.util.Iterator;
|
|||
* </p>
|
||||
* <p>
|
||||
* In use, this iterator iterates through the keys in the map. After each call
|
||||
* to <code>next()</code>, the <code>getValue()</code> method provides direct
|
||||
* access to the value. The value can also be set using <code>setValue()</code>.
|
||||
* to {@code next()}, the {@code getValue()} method provides direct
|
||||
* access to the value. The value can also be set using {@code setValue()}.
|
||||
* </p>
|
||||
* <pre>{@code
|
||||
* MapIterator<String,Integer> it = map.mapIterator();
|
||||
|
@ -52,13 +52,13 @@ public interface MapIterator<K, V> extends Iterator<K> {
|
|||
/**
|
||||
* Checks to see if there are more entries still to be iterated.
|
||||
*
|
||||
* @return <code>true</code> if the iterator has more elements
|
||||
* @return {@code true} if the iterator has more elements
|
||||
*/
|
||||
@Override
|
||||
boolean hasNext();
|
||||
|
||||
/**
|
||||
* Gets the next <em>key</em> from the <code>Map</code>.
|
||||
* Gets the next <em>key</em> from the {@code Map}.
|
||||
*
|
||||
* @return the next key in the iteration
|
||||
* @throws java.util.NoSuchElementException if the iteration is finished
|
||||
|
@ -69,32 +69,32 @@ public interface MapIterator<K, V> extends Iterator<K> {
|
|||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets the current key, which is the key returned by the last call
|
||||
* to <code>next()</code>.
|
||||
* to {@code next()}.
|
||||
*
|
||||
* @return the current key
|
||||
* @throws IllegalStateException if <code>next()</code> has not yet been called
|
||||
* @throws IllegalStateException if {@code next()} has not yet been called
|
||||
*/
|
||||
K getKey();
|
||||
|
||||
/**
|
||||
* Gets the current value, which is the value associated with the last key
|
||||
* returned by <code>next()</code>.
|
||||
* returned by {@code next()}.
|
||||
*
|
||||
* @return the current value
|
||||
* @throws IllegalStateException if <code>next()</code> has not yet been called
|
||||
* @throws IllegalStateException if {@code next()} has not yet been called
|
||||
*/
|
||||
V getValue();
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Removes the last returned key from the underlying <code>Map</code> (optional operation).
|
||||
* Removes the last returned key from the underlying {@code Map} (optional operation).
|
||||
* <p>
|
||||
* This method can be called once per call to <code>next()</code>.
|
||||
* This method can be called once per call to {@code next()}.
|
||||
*
|
||||
* @throws UnsupportedOperationException if remove is not supported by the map
|
||||
* @throws IllegalStateException if <code>next()</code> has not yet been called
|
||||
* @throws IllegalStateException if <code>remove()</code> has already been called
|
||||
* since the last call to <code>next()</code>
|
||||
* @throws IllegalStateException if {@code next()} has not yet been called
|
||||
* @throws IllegalStateException if {@code remove()} has already been called
|
||||
* since the last call to {@code next()}
|
||||
*/
|
||||
@Override
|
||||
void remove();
|
||||
|
@ -105,9 +105,9 @@ public interface MapIterator<K, V> extends Iterator<K> {
|
|||
* @param value the new value
|
||||
* @return the previous value
|
||||
* @throws UnsupportedOperationException if setValue is not supported by the map
|
||||
* @throws IllegalStateException if <code>next()</code> has not yet been called
|
||||
* @throws IllegalStateException if <code>remove()</code> has been called since the
|
||||
* last call to <code>next()</code>
|
||||
* @throws IllegalStateException if {@code next()} has not yet been called
|
||||
* @throws IllegalStateException if {@code remove()} has been called since the
|
||||
* last call to {@code next()}
|
||||
*/
|
||||
V setValue(V value);
|
||||
|
||||
|
|
|
@ -161,22 +161,22 @@ public class MapUtils {
|
|||
* </p>
|
||||
*
|
||||
* @param out the stream to print to, must not be null
|
||||
* @param label The label to be used, may be <code>null</code>. If <code>null</code>, the label is not output. It
|
||||
* @param label The label to be used, may be {@code null}. If {@code null}, the label is not output. It
|
||||
* typically represents the name of the property in a bean or similar.
|
||||
* @param map The map to print, may be <code>null</code>. If <code>null</code>, the text 'null' is output.
|
||||
* @throws NullPointerException if the stream is <code>null</code>
|
||||
* @param map The map to print, may be {@code null}. If {@code null}, the text 'null' is output.
|
||||
* @throws NullPointerException if the stream is {@code null}
|
||||
*/
|
||||
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) {
|
||||
verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable empty map if the argument is <code>null</code>, or the argument itself otherwise.
|
||||
* Returns an immutable empty map if the argument is {@code null}, or the argument itself otherwise.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @param map the map, possibly <code>null</code>
|
||||
* @return an empty map if the argument is <code>null</code>
|
||||
* @param map the map, possibly {@code null}
|
||||
* @return an empty map if the argument is {@code null}
|
||||
*/
|
||||
public static <K, V> Map<K, V> emptyIfNull(final Map<K, V> map) {
|
||||
return map == null ? Collections.<K, V>emptyMap() : map;
|
||||
|
@ -213,15 +213,15 @@ public class MapUtils {
|
|||
/**
|
||||
* Gets a Boolean from a Map in a null-safe manner.
|
||||
* <p>
|
||||
* If the value is a <code>Boolean</code> it is returned directly. If the value is a <code>String</code> and it
|
||||
* equals 'true' ignoring case then <code>true</code> is returned, otherwise <code>false</code>. If the value is a
|
||||
* <code>Number</code> an integer zero value returns <code>false</code> and non-zero returns <code>true</code>.
|
||||
* Otherwise, <code>null</code> is returned.
|
||||
* If the value is a {@code Boolean} it is returned directly. If the value is a {@code String} and it
|
||||
* equals 'true' ignoring case then {@code true} is returned, otherwise {@code false}. If the value is a
|
||||
* {@code Number} an integer zero value returns {@code false} and non-zero returns {@code true}.
|
||||
* Otherwise, {@code null} is returned.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Boolean, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Boolean, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Boolean getBoolean(final Map<? super K, ?> map, final K key) {
|
||||
if (map != null) {
|
||||
|
@ -279,16 +279,16 @@ public class MapUtils {
|
|||
/**
|
||||
* Gets a boolean from a Map in a null-safe manner.
|
||||
* <p>
|
||||
* If the value is a <code>Boolean</code> its value is returned. If the value is a <code>String</code> and it equals
|
||||
* 'true' ignoring case then <code>true</code> is returned, otherwise <code>false</code>. If the value is a
|
||||
* <code>Number</code> an integer zero value returns <code>false</code> and non-zero returns <code>true</code>.
|
||||
* Otherwise, <code>false</code> is returned.
|
||||
* If the value is a {@code Boolean} its value is returned. If the value is a {@code String} and it equals
|
||||
* 'true' ignoring case then {@code true} is returned, otherwise {@code false}. If the value is a
|
||||
* {@code Number} an integer zero value returns {@code false} and non-zero returns {@code true}.
|
||||
* Otherwise, {@code false} is returned.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Boolean, <code>false</code> if null map input
|
||||
* @return the value in the Map as a Boolean, {@code false} if null map input
|
||||
*/
|
||||
public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key) {
|
||||
return Boolean.TRUE.equals(getBoolean(map, key));
|
||||
|
@ -299,17 +299,17 @@ public class MapUtils {
|
|||
/**
|
||||
* Gets a boolean from a Map in a null-safe manner, using the default value if the conversion fails.
|
||||
* <p>
|
||||
* If the value is a <code>Boolean</code> its value is returned. If the value is a <code>String</code> and it equals
|
||||
* 'true' ignoring case then <code>true</code> is returned, otherwise <code>false</code>. If the value is a
|
||||
* <code>Number</code> an integer zero value returns <code>false</code> and non-zero returns <code>true</code>.
|
||||
* Otherwise, <code>defaultValue</code> is returned.
|
||||
* If the value is a {@code Boolean} its value is returned. If the value is a {@code String} and it equals
|
||||
* 'true' ignoring case then {@code true} is returned, otherwise {@code false}. If the value is a
|
||||
* {@code Number} an integer zero value returns {@code false} and non-zero returns {@code true}.
|
||||
* Otherwise, {@code defaultValue} is returned.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a Boolean, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as a Boolean, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key, final boolean defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getBoolean, defaultValue).booleanValue();
|
||||
|
@ -319,17 +319,17 @@ public class MapUtils {
|
|||
* Gets a boolean from a Map in a null-safe manner, using the default value produced by the defaultFunction if the
|
||||
* conversion fails.
|
||||
* <p>
|
||||
* If the value is a <code>Boolean</code> its value is returned. If the value is a <code>String</code> and it equals
|
||||
* 'true' ignoring case then <code>true</code> is returned, otherwise <code>false</code>. If the value is a
|
||||
* <code>Number</code> an integer zero value returns <code>false</code> and non-zero returns <code>true</code>.
|
||||
* Otherwise, defaultValue produced by the <code>defaultFunction</code> is returned.
|
||||
* If the value is a {@code Boolean} its value is returned. If the value is a {@code String} and it equals
|
||||
* 'true' ignoring case then {@code true} is returned, otherwise {@code false}. If the value is a
|
||||
* {@code Number} an integer zero value returns {@code false} and non-zero returns {@code true}.
|
||||
* Otherwise, defaultValue produced by the {@code defaultFunction} is returned.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a Boolean, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as a Boolean, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -347,7 +347,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Byte, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Byte, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Byte getByte(final Map<? super K, ?> map, final K key) {
|
||||
final Number answer = getNumber(map, key);
|
||||
|
@ -400,7 +400,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a byte, <code>0</code> if null map input
|
||||
* @return the value in the Map as a byte, {@code 0} if null map input
|
||||
*/
|
||||
public static <K> byte getByteValue(final Map<? super K, ?> map, final K key) {
|
||||
return applyDefaultValue(map, key, MapUtils::getByte, 0).byteValue();
|
||||
|
@ -416,7 +416,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a byte, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as a byte, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> byte getByteValue(final Map<? super K, ?> map, final K key, final byte defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getByte, defaultValue).byteValue();
|
||||
|
@ -433,7 +433,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a byte, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as a byte, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -451,7 +451,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Double, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Double, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Double getDouble(final Map<? super K, ?> map, final K key) {
|
||||
final Number answer = getNumber(map, key);
|
||||
|
@ -505,7 +505,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a double, <code>0.0</code> if null map input
|
||||
* @return the value in the Map as a double, {@code 0.0} if null map input
|
||||
*/
|
||||
public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key) {
|
||||
return applyDefaultValue(map, key, MapUtils::getDouble, 0d).doubleValue();
|
||||
|
@ -521,7 +521,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a double, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as a double, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key, final double defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getDouble, defaultValue).doubleValue();
|
||||
|
@ -538,7 +538,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a double, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as a double, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -556,7 +556,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Float, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Float, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Float getFloat(final Map<? super K, ?> map, final K key) {
|
||||
final Number answer = getNumber(map, key);
|
||||
|
@ -610,7 +610,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a float, <code>0.0F</code> if null map input
|
||||
* @return the value in the Map as a float, {@code 0.0F} if null map input
|
||||
*/
|
||||
public static <K> float getFloatValue(final Map<? super K, ?> map, final K key) {
|
||||
return applyDefaultValue(map, key, MapUtils::getFloat, 0f).floatValue();
|
||||
|
@ -626,7 +626,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a float, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as a float, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> float getFloatValue(final Map<? super K, ?> map, final K key, final float defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getFloat, defaultValue).floatValue();
|
||||
|
@ -643,7 +643,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a float, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as a float, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -661,7 +661,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Integer, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Integer, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Integer getInteger(final Map<? super K, ?> map, final K key) {
|
||||
final Number answer = getNumber(map, key);
|
||||
|
@ -715,7 +715,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as an int, <code>0</code> if null map input
|
||||
* @return the value in the Map as an int, {@code 0} if null map input
|
||||
*/
|
||||
public static <K> int getIntValue(final Map<? super K, ?> map, final K key) {
|
||||
return applyDefaultValue(map, key, MapUtils::getInteger, 0).intValue();
|
||||
|
@ -732,7 +732,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as an int, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as an int, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -751,7 +751,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as an int, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as an int, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> int getIntValue(final Map<? super K, ?> map, final K key, final int defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getInteger, defaultValue).intValue();
|
||||
|
@ -766,7 +766,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Long, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Long, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Long getLong(final Map<? super K, ?> map, final K key) {
|
||||
final Number answer = getNumber(map, key);
|
||||
|
@ -819,7 +819,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a long, <code>0L</code> if null map input
|
||||
* @return the value in the Map as a long, {@code 0L} if null map input
|
||||
*/
|
||||
public static <K> long getLongValue(final Map<? super K, ?> map, final K key) {
|
||||
return applyDefaultValue(map, key, MapUtils::getLong, 0L).longValue();
|
||||
|
@ -836,7 +836,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a long, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as a long, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -855,7 +855,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a long, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as a long, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> long getLongValue(final Map<? super K, ?> map, final K key, final long defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getLong, defaultValue).longValue();
|
||||
|
@ -864,13 +864,13 @@ public class MapUtils {
|
|||
/**
|
||||
* Gets a Map from a Map in a null-safe manner.
|
||||
* <p>
|
||||
* If the value returned from the specified map is not a Map then <code>null</code> is returned.
|
||||
* If the value returned from the specified map is not a Map then {@code null} is returned.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Map, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Map, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Map<?, ?> getMap(final Map<? super K, ?> map, final K key) {
|
||||
if (map != null) {
|
||||
|
@ -917,15 +917,15 @@ public class MapUtils {
|
|||
/**
|
||||
* Gets a Number from a Map in a null-safe manner.
|
||||
* <p>
|
||||
* If the value is a <code>Number</code> it is returned directly. If the value is a <code>String</code> it is
|
||||
* converted using {@link NumberFormat#parse(String)} on the system default formatter returning <code>null</code> if
|
||||
* the conversion fails. Otherwise, <code>null</code> is returned.
|
||||
* If the value is a {@code Number} it is returned directly. If the value is a {@code String} it is
|
||||
* converted using {@link NumberFormat#parse(String)} on the system default formatter returning {@code null} if
|
||||
* the conversion fails. Otherwise, {@code null} is returned.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Number, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Number, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Number getNumber(final Map<? super K, ?> map, final K key) {
|
||||
if (map != null) {
|
||||
|
@ -987,7 +987,7 @@ public class MapUtils {
|
|||
* @param <V> the value type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map, <code>null</code> if null map input
|
||||
* @return the value in the Map, {@code null} if null map input
|
||||
*/
|
||||
public static <K, V> V getObject(final Map<? super K, V> map, final K key) {
|
||||
if (map != null) {
|
||||
|
@ -1026,7 +1026,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a Short, <code>null</code> if null map input
|
||||
* @return the value in the Map as a Short, {@code null} if null map input
|
||||
*/
|
||||
public static <K> Short getShort(final Map<? super K, ?> map, final K key) {
|
||||
final Number answer = getNumber(map, key);
|
||||
|
@ -1080,7 +1080,7 @@ public class MapUtils {
|
|||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a short, <code>0</code> if null map input
|
||||
* @return the value in the Map as a short, {@code 0} if null map input
|
||||
*/
|
||||
public static <K> short getShortValue(final Map<? super K, ?> map, final K key) {
|
||||
return applyDefaultValue(map, key, MapUtils::getShort, 0).shortValue();
|
||||
|
@ -1097,7 +1097,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultFunction produce the default value to return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a short, default value produced by the <code>defaultFunction</code> if null map
|
||||
* @return the value in the Map as a short, default value produced by the {@code defaultFunction} if null map
|
||||
* input
|
||||
* @since 4.5
|
||||
*/
|
||||
|
@ -1116,7 +1116,7 @@ public class MapUtils {
|
|||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @param defaultValue return if the value is null or if the conversion fails
|
||||
* @return the value in the Map as a short, <code>defaultValue</code> if null map input
|
||||
* @return the value in the Map as a short, {@code defaultValue} if null map input
|
||||
*/
|
||||
public static <K> short getShortValue(final Map<? super K, ?> map, final K key, final short defaultValue) {
|
||||
return applyDefaultValue(map, key, MapUtils::getShort, defaultValue).shortValue();
|
||||
|
@ -1125,13 +1125,13 @@ public class MapUtils {
|
|||
/**
|
||||
* Gets a String from a Map in a null-safe manner.
|
||||
* <p>
|
||||
* The String is obtained via <code>toString</code>.
|
||||
* The String is obtained via {@code toString}.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param map the map to use
|
||||
* @param key the key to look up
|
||||
* @return the value in the Map as a String, <code>null</code> if null map input
|
||||
* @return the value in the Map as a String, {@code null} if null map input
|
||||
*/
|
||||
public static <K> String getString(final Map<? super K, ?> map, final K key) {
|
||||
if (map != null) {
|
||||
|
@ -1282,8 +1282,8 @@ public class MapUtils {
|
|||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* After the above code is executed, <code>obj</code> will contain a new <code>Date</code> instance. Furthermore,
|
||||
* that <code>Date</code> instance is the value for the <code>"test"</code> key in the map.
|
||||
* After the above code is executed, {@code obj} will contain a new {@code Date} instance. Furthermore,
|
||||
* that {@code Date} instance is the value for the {@code "test"} key in the map.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
|
@ -1320,8 +1320,8 @@ public class MapUtils {
|
|||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* After the above code is executed, <code>obj</code> will contain a new <code>File</code> instance for the C drive
|
||||
* dev directory. Furthermore, that <code>File</code> instance is the value for the <code>"C:/dev"</code> key in the
|
||||
* After the above code is executed, {@code obj} will contain a new {@code File} instance for the C drive
|
||||
* dev directory. Furthermore, that {@code File} instance is the value for the {@code "C:/dev"} key in the
|
||||
* map.
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -1361,8 +1361,8 @@ public class MapUtils {
|
|||
* Object obj = lazy.get("test");
|
||||
* </pre>
|
||||
* <p>
|
||||
* After the above code is executed, <code>obj</code> will contain a new <code>Date</code> instance. Furthermore,
|
||||
* that <code>Date</code> instance is the value for the <code>"test"</code> key.
|
||||
* After the above code is executed, {@code obj} will contain a new {@code Date} instance. Furthermore,
|
||||
* that {@code Date} instance is the value for the {@code "test"} key.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the key type
|
||||
|
@ -1396,8 +1396,8 @@ public class MapUtils {
|
|||
* Object obj = lazy.get("C:/dev");
|
||||
* </pre>
|
||||
* <p>
|
||||
* After the above code is executed, <code>obj</code> will contain a new <code>File</code> instance for the C drive
|
||||
* dev directory. Furthermore, that <code>File</code> instance is the value for the <code>"C:/dev"</code> key in the
|
||||
* After the above code is executed, {@code obj} will contain a new {@code File} instance for the C drive
|
||||
* dev directory. Furthermore, that {@code File} instance is the value for the {@code "C:/dev"} key in the
|
||||
* map.
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -1493,15 +1493,15 @@ public class MapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Populates a Map using the supplied <code>Transformer</code>s to transform the elements into keys and values.
|
||||
* Populates a Map using the supplied {@code Transformer}s to transform the elements into keys and values.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @param <E> the type of object contained in the {@link Iterable}
|
||||
* @param map the <code>Map</code> to populate.
|
||||
* @param elements the <code>Iterable</code> containing the input values for the map.
|
||||
* @param keyTransformer the <code>Transformer</code> used to transform the element into a key value
|
||||
* @param valueTransformer the <code>Transformer</code> used to transform the element into a value
|
||||
* @param map the {@code Map} to populate.
|
||||
* @param elements the {@code Iterable} containing the input values for the map.
|
||||
* @param keyTransformer the {@code Transformer} used to transform the element into a key value
|
||||
* @param valueTransformer the {@code Transformer} used to transform the element into a value
|
||||
* @throws NullPointerException if the map, elements or transformers are null
|
||||
*/
|
||||
public static <K, V, E> void populateMap(final Map<K, V> map, final Iterable<? extends E> elements,
|
||||
|
@ -1514,14 +1514,14 @@ public class MapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Populates a Map using the supplied <code>Transformer</code> to transform the elements into keys, using the
|
||||
* unaltered element as the value in the <code>Map</code>.
|
||||
* Populates a Map using the supplied {@code Transformer} to transform the elements into keys, using the
|
||||
* unaltered element as the value in the {@code Map}.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @param map the <code>Map</code> to populate.
|
||||
* @param elements the <code>Iterable</code> containing the input values for the map.
|
||||
* @param keyTransformer the <code>Transformer</code> used to transform the element into a key value
|
||||
* @param map the {@code Map} to populate.
|
||||
* @param elements the {@code Iterable} containing the input values for the map.
|
||||
* @param keyTransformer the {@code Transformer} used to transform the element into a key value
|
||||
* @throws NullPointerException if the map, elements or transformer are null
|
||||
*/
|
||||
public static <K, V> void populateMap(final Map<K, V> map, final Iterable<? extends V> elements,
|
||||
|
@ -1530,15 +1530,15 @@ public class MapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Populates a MultiMap using the supplied <code>Transformer</code>s to transform the elements into keys and values.
|
||||
* Populates a MultiMap using the supplied {@code Transformer}s to transform the elements into keys and values.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @param <E> the type of object contained in the {@link Iterable}
|
||||
* @param map the <code>MultiMap</code> to populate.
|
||||
* @param elements the <code>Iterable</code> containing the input values for the map.
|
||||
* @param keyTransformer the <code>Transformer</code> used to transform the element into a key value
|
||||
* @param valueTransformer the <code>Transformer</code> used to transform the element into a value
|
||||
* @param map the {@code MultiMap} to populate.
|
||||
* @param elements the {@code Iterable} containing the input values for the map.
|
||||
* @param keyTransformer the {@code Transformer} used to transform the element into a key value
|
||||
* @param valueTransformer the {@code Transformer} used to transform the element into a value
|
||||
* @throws NullPointerException if the map, collection or transformers are null
|
||||
*/
|
||||
public static <K, V, E> void populateMap(final MultiMap<K, V> map, final Iterable<? extends E> elements,
|
||||
|
@ -1551,14 +1551,14 @@ public class MapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Populates a MultiMap using the supplied <code>Transformer</code> to transform the elements into keys, using the
|
||||
* unaltered element as the value in the <code>MultiMap</code>.
|
||||
* Populates a MultiMap using the supplied {@code Transformer} to transform the elements into keys, using the
|
||||
* unaltered element as the value in the {@code MultiMap}.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @param map the <code>MultiMap</code> to populate.
|
||||
* @param elements the <code>Iterable</code> to use as input values for the map.
|
||||
* @param keyTransformer the <code>Transformer</code> used to transform the element into a key value
|
||||
* @param map the {@code MultiMap} to populate.
|
||||
* @param elements the {@code Iterable} to use as input values for the map.
|
||||
* @param keyTransformer the {@code Transformer} used to transform the element into a key value
|
||||
* @throws NullPointerException if the map, elements or transformer are null
|
||||
*/
|
||||
public static <K, V> void populateMap(final MultiMap<K, V> map, final Iterable<? extends V> elements,
|
||||
|
@ -1957,10 +1957,10 @@ public class MapUtils {
|
|||
* </p>
|
||||
*
|
||||
* @param out the stream to print to, must not be null
|
||||
* @param label The label to be used, may be <code>null</code>. If <code>null</code>, the label is not output. It
|
||||
* @param label The label to be used, may be {@code null}. If {@code null}, the label is not output. It
|
||||
* typically represents the name of the property in a bean or similar.
|
||||
* @param map The map to print, may be <code>null</code>. If <code>null</code>, the text 'null' is output.
|
||||
* @throws NullPointerException if the stream is <code>null</code>
|
||||
* @param map The map to print, may be {@code null}. If {@code null}, the text 'null' is output.
|
||||
* @throws NullPointerException if the stream is {@code null}
|
||||
*/
|
||||
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) {
|
||||
verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false);
|
||||
|
@ -1975,13 +1975,13 @@ public class MapUtils {
|
|||
* grandfather, great-grandfather, etc).
|
||||
*
|
||||
* @param out the stream to print to
|
||||
* @param label the label to be used, may be <code>null</code>. If <code>null</code>, the label is not output. It
|
||||
* @param label the label to be used, may be {@code null}. If {@code null}, the label is not output. It
|
||||
* typically represents the name of the property in a bean or similar.
|
||||
* @param map the map to print, may be <code>null</code>. If <code>null</code>, the text 'null' is output
|
||||
* @param map the map to print, may be {@code null}. If {@code null}, the text 'null' is output
|
||||
* @param lineage a stack consisting of any maps in which the previous argument is contained. This is checked to
|
||||
* avoid infinite recursion when printing the output
|
||||
* @param debug flag indicating whether type names should be output.
|
||||
* @throws NullPointerException if the stream is <code>null</code>
|
||||
* @throws NullPointerException if the stream is {@code null}
|
||||
*/
|
||||
private static void verbosePrintInternal(final PrintStream out, final Object label, final Map<?, ?> map,
|
||||
final Deque<Map<?, ?>> lineage, final boolean debug) {
|
||||
|
@ -2040,7 +2040,7 @@ public class MapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* <code>MapUtils</code> should not normally be instantiated.
|
||||
* {@code MapUtils} should not normally be instantiated.
|
||||
*/
|
||||
private MapUtils() {
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Collection;
|
|||
/**
|
||||
* Defines a map that holds a collection of values against each key.
|
||||
* <p>
|
||||
* A <code>MultiMap</code> is a Map with slightly different semantics.
|
||||
* A {@code MultiMap} is a Map with slightly different semantics.
|
||||
* Putting a value into the map will add the value to a Collection at that key.
|
||||
* Getting a value will return a Collection, holding all the values put to that key.
|
||||
* </p>
|
||||
|
@ -35,12 +35,12 @@ import java.util.Collection;
|
|||
* mhm.put(key, "C");
|
||||
* Collection coll = (Collection) mhm.get(key);</pre>
|
||||
* <p>
|
||||
* <code>coll</code> will be a collection containing "A", "B", "C".
|
||||
* {@code coll} will be a collection containing "A", "B", "C".
|
||||
* </p>
|
||||
* <p>
|
||||
* NOTE: Additional methods were added to this interface in Commons Collections 3.1.
|
||||
* These were added solely for documentation purposes and do not change the interface
|
||||
* as they were defined in the superinterface <code>Map</code> anyway.
|
||||
* as they were defined in the superinterface {@code Map} anyway.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the type of the keys in this map
|
||||
|
@ -59,7 +59,7 @@ public interface MultiMap<K, V> extends IterableMap<K, Object> {
|
|||
* Other values attached to that key are unaffected.
|
||||
* <p>
|
||||
* If the last value for a key is removed, implementations typically
|
||||
* return <code>null</code> from a subsequent <code>get(Object)</code>, however
|
||||
* return {@code null} from a subsequent {@code get(Object)}, however
|
||||
* they may choose to return an empty collection.
|
||||
*
|
||||
* @param key the key to remove from
|
||||
|
@ -87,19 +87,19 @@ public interface MultiMap<K, V> extends IterableMap<K, Object> {
|
|||
/**
|
||||
* Gets the collection of values associated with the specified key.
|
||||
* <p>
|
||||
* The returned value will implement <code>Collection</code>. Implementations
|
||||
* are free to declare that they return <code>Collection</code> subclasses
|
||||
* such as <code>List</code> or <code>Set</code>.
|
||||
* The returned value will implement {@code Collection}. Implementations
|
||||
* are free to declare that they return {@code Collection} subclasses
|
||||
* such as {@code List} or {@code Set}.
|
||||
* <p>
|
||||
* Implementations typically return <code>null</code> if no values have
|
||||
* Implementations typically return {@code null} if no values have
|
||||
* been mapped to the key, however the implementation may choose to
|
||||
* return an empty collection.
|
||||
* <p>
|
||||
* Implementations may choose to return a clone of the internal collection.
|
||||
*
|
||||
* @param key the key to retrieve
|
||||
* @return the <code>Collection</code> of values, implementations should
|
||||
* return <code>null</code> for no mapping, but may return an empty collection
|
||||
* @return the {@code Collection} of values, implementations should
|
||||
* return {@code null} for no mapping, but may return an empty collection
|
||||
* @throws ClassCastException if the key is of an invalid type
|
||||
* @throws NullPointerException if the key is null and null keys are invalid
|
||||
*/
|
||||
|
@ -123,9 +123,9 @@ public interface MultiMap<K, V> extends IterableMap<K, Object> {
|
|||
/**
|
||||
* Adds the value to the collection associated with the specified key.
|
||||
* <p>
|
||||
* Unlike a normal <code>Map</code> the previous value is not replaced.
|
||||
* Unlike a normal {@code Map} the previous value is not replaced.
|
||||
* Instead the new value is added to the collection stored against the key.
|
||||
* The collection may be a <code>List</code>, <code>Set</code> or other
|
||||
* The collection may be a {@code List}, {@code Set} or other
|
||||
* collection dependent on implementation.
|
||||
*
|
||||
* @param key the key to store against
|
||||
|
@ -142,12 +142,12 @@ public interface MultiMap<K, V> extends IterableMap<K, Object> {
|
|||
/**
|
||||
* Removes all values associated with the specified key.
|
||||
* <p>
|
||||
* Implementations typically return <code>null</code> from a subsequent
|
||||
* <code>get(Object)</code>, however they may choose to return an empty collection.
|
||||
* Implementations typically return {@code null} from a subsequent
|
||||
* {@code get(Object)}, however they may choose to return an empty collection.
|
||||
*
|
||||
* @param key the key to remove values from
|
||||
* @return the <code>Collection</code> of values removed, implementations should
|
||||
* return <code>null</code> for no mapping found, but may return an empty collection
|
||||
* @return the {@code Collection} of values removed, implementations should
|
||||
* return {@code null} for no mapping found, but may return an empty collection
|
||||
* @throws UnsupportedOperationException if the map is unmodifiable
|
||||
* @throws ClassCastException if the key is of an invalid type
|
||||
* @throws NullPointerException if the key is null and null keys are invalid
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.commons.collections4.multimap.UnmodifiableMultiValuedMap;
|
|||
public class MultiMapUtils {
|
||||
|
||||
/**
|
||||
* <code>MultiMapUtils</code> should not normally be instantiated.
|
||||
* {@code MultiMapUtils} should not normally be instantiated.
|
||||
*/
|
||||
private MultiMapUtils() {}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class MultiMapUtils {
|
|||
*
|
||||
* @param <K> the type of key in the map
|
||||
* @param <V> the type of value in the map
|
||||
* @return immutable and empty <code>MultiValuedMap</code>
|
||||
* @return immutable and empty {@code MultiValuedMap}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K, V> MultiValuedMap<K, V> emptyMultiValuedMap() {
|
||||
|
@ -70,8 +70,8 @@ public class MultiMapUtils {
|
|||
// Null safe methods
|
||||
|
||||
/**
|
||||
* Returns an immutable empty <code>MultiValuedMap</code> if the argument is
|
||||
* <code>null</code>, or the argument itself otherwise.
|
||||
* Returns an immutable empty {@code MultiValuedMap} if the argument is
|
||||
* {@code null}, or the argument itself otherwise.
|
||||
*
|
||||
* @param <K> the type of key in the map
|
||||
* @param <V> the type of value in the map
|
||||
|
@ -84,7 +84,7 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Null-safe check if the specified <code>MultiValuedMap</code> is empty.
|
||||
* Null-safe check if the specified {@code MultiValuedMap} is empty.
|
||||
* <p>
|
||||
* If the provided map is null, returns true.
|
||||
*
|
||||
|
@ -99,7 +99,7 @@ public class MultiMapUtils {
|
|||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Gets a Collection from <code>MultiValuedMap</code> in a null-safe manner.
|
||||
* Gets a Collection from {@code MultiValuedMap} in a null-safe manner.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
|
@ -118,7 +118,7 @@ public class MultiMapUtils {
|
|||
// to the returned collection might update the backing map. This should be clarified and/or prevented.
|
||||
|
||||
/**
|
||||
* Gets a List from <code>MultiValuedMap</code> in a null-safe manner.
|
||||
* Gets a List from {@code MultiValuedMap} in a null-safe manner.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
|
@ -138,7 +138,7 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a Set from <code>MultiValuedMap</code> in a null-safe manner.
|
||||
* Gets a Set from {@code MultiValuedMap} in a null-safe manner.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
|
@ -158,7 +158,7 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a Bag from <code>MultiValuedMap</code> in a null-safe manner.
|
||||
* Gets a Bag from {@code MultiValuedMap} in a null-safe manner.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
|
@ -186,7 +186,7 @@ public class MultiMapUtils {
|
|||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
* @return a new <code>ListValuedMap</code>
|
||||
* @return a new {@code ListValuedMap}
|
||||
*/
|
||||
public static <K, V> ListValuedMap<K, V> newListValuedHashMap() {
|
||||
return new ArrayListValuedHashMap<>();
|
||||
|
@ -208,7 +208,7 @@ public class MultiMapUtils {
|
|||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns an <code>UnmodifiableMultiValuedMap</code> backed by the given
|
||||
* Returns an {@code UnmodifiableMultiValuedMap} backed by the given
|
||||
* map.
|
||||
*
|
||||
* @param <K> the key type
|
||||
|
@ -223,9 +223,9 @@ public class MultiMapUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>TransformedMultiValuedMap</code> backed by the given map.
|
||||
* Returns a {@code TransformedMultiValuedMap} backed by the given map.
|
||||
* <p>
|
||||
* This method returns a new <code>MultiValuedMap</code> (decorating the
|
||||
* This method returns a new {@code MultiValuedMap} (decorating the
|
||||
* specified map) that will transform any new entries added to it. Existing
|
||||
* entries in the specified map will not be transformed. If you want that
|
||||
* behaviour, see {@link TransformedMultiValuedMap#transformedMap}.
|
||||
|
@ -242,7 +242,7 @@ public class MultiMapUtils {
|
|||
* @param map the {@link MultiValuedMap} to transform, must not be null, typically empty
|
||||
* @param keyTransformer the transformer for the map keys, null means no transformation
|
||||
* @param valueTransformer the transformer for the map values, null means no transformation
|
||||
* @return a transformed <code>MultiValuedMap</code> backed by the given map
|
||||
* @return a transformed {@code MultiValuedMap} backed by the given map
|
||||
* @throws NullPointerException if map is null
|
||||
*/
|
||||
public static <K, V> MultiValuedMap<K, V> transformedMultiValuedMap(final MultiValuedMap<K, V> map,
|
||||
|
|
|
@ -24,9 +24,9 @@ import java.util.Set;
|
|||
* Defines a collection that counts the number of times an object appears in
|
||||
* the collection.
|
||||
* <p>
|
||||
* Suppose you have a MultiSet that contains <code>{a, a, b, c}</code>.
|
||||
* Calling {@link #getCount(Object)} on <code>a</code> would return 2, while
|
||||
* calling {@link #uniqueSet()} would return <code>{a, b, c}</code>.
|
||||
* Suppose you have a MultiSet that contains {@code {a, a, b, c}}.
|
||||
* Calling {@link #getCount(Object)} on {@code a} would return 2, while
|
||||
* calling {@link #uniqueSet()} would return {@code {a, b, c}}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type held in the multiset
|
||||
|
@ -67,7 +67,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* {@link #uniqueSet()} and report its count as 1.
|
||||
*
|
||||
* @param object the object to add
|
||||
* @return <code>true</code> always, as the size of the MultiSet is increased
|
||||
* @return {@code true} always, as the size of the MultiSet is increased
|
||||
* in any case
|
||||
*/
|
||||
@Override
|
||||
|
@ -78,7 +78,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* <p>
|
||||
* If the object is already in the {@link #uniqueSet()} then increment its
|
||||
* count as reported by {@link #getCount(Object)}. Otherwise add it to the
|
||||
* {@link #uniqueSet()} and report its count as <code>occurrences</code>.
|
||||
* {@link #uniqueSet()} and report its count as {@code occurrences}.
|
||||
*
|
||||
* @param object the object to add
|
||||
* @param occurrences the number of occurrences to add, may be zero,
|
||||
|
@ -96,7 +96,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* to zero, the object will be removed from the {@link #uniqueSet()}.
|
||||
*
|
||||
* @param object the object to remove
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
boolean remove(Object object);
|
||||
|
@ -159,11 +159,11 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
int size();
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the MultiSet contains at least one
|
||||
* Returns {@code true} if the MultiSet contains at least one
|
||||
* occurrence for each element contained in the given collection.
|
||||
*
|
||||
* @param coll the collection to check against
|
||||
* @return <code>true</code> if the MultiSet contains all the collection
|
||||
* @return {@code true} if the MultiSet contains all the collection
|
||||
*/
|
||||
@Override
|
||||
boolean containsAll(Collection<?> coll);
|
||||
|
@ -173,7 +173,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* in the given collection.
|
||||
*
|
||||
* @param coll the collection of elements to remove
|
||||
* @return <code>true</code> if this call changed the multiset
|
||||
* @return {@code true} if this call changed the multiset
|
||||
*/
|
||||
@Override
|
||||
boolean removeAll(Collection<?> coll);
|
||||
|
@ -183,7 +183,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* given collection.
|
||||
*
|
||||
* @param coll the collection of elements to retain
|
||||
* @return <code>true</code> if this call changed the multiset
|
||||
* @return {@code true} if this call changed the multiset
|
||||
*/
|
||||
@Override
|
||||
boolean retainAll(Collection<?> coll);
|
||||
|
@ -204,7 +204,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* Gets a hash code for the MultiSet compatible with the definition of equals.
|
||||
* The hash code is defined as the sum total of a hash code for each element.
|
||||
* The per element hash code is defined as
|
||||
* <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>.
|
||||
* {@code (e==null ? 0 : e.hashCode()) ^ noOccurances)}.
|
||||
*
|
||||
* @return the hash code of the MultiSet
|
||||
*/
|
||||
|
@ -241,7 +241,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
* and the two entries represent the same element with the same
|
||||
* number of occurrences.
|
||||
* <p>
|
||||
* More formally, two entries <code>e1</code> and <code>e2</code> represent
|
||||
* More formally, two entries {@code e1} and {@code e2} represent
|
||||
* the same mapping if
|
||||
* <pre>
|
||||
* (e1.getElement()==null ? e2.getElement()==null
|
||||
|
@ -258,7 +258,7 @@ public interface MultiSet<E> extends Collection<E> {
|
|||
/**
|
||||
* Returns the hash code value for this multiset entry.
|
||||
* <p>
|
||||
* The hash code of a multiset entry <code>e</code> is defined to be:
|
||||
* The hash code of a multiset entry {@code e} is defined to be:
|
||||
* <pre>
|
||||
* (e==null ? 0 : e.hashCode()) ^ noOccurances)
|
||||
* </pre>
|
||||
|
|
|
@ -105,7 +105,7 @@ public class MultiSetUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an empty <code>MultiSet</code>.
|
||||
* Get an empty {@code MultiSet}.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return an empty MultiSet
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.Set;
|
|||
* Collection<String> coll = map.get(1);
|
||||
* }</pre>
|
||||
* <p>
|
||||
* <code>coll</code> will be a collection containing "A", "B", "C".
|
||||
* {@code coll} will be a collection containing "A", "B", "C".
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the type of the keys in this map
|
||||
|
@ -219,7 +219,7 @@ public interface MultiValuedMap<K, V> {
|
|||
* Other values attached to that key are unaffected.
|
||||
* <p>
|
||||
* If the last value for a key is removed, implementations typically return
|
||||
* an empty collection from a subsequent <code>get(Object)</code>.
|
||||
* an empty collection from a subsequent {@code get(Object)}.
|
||||
*
|
||||
* @param key the key to remove from
|
||||
* @param item the item to remove
|
||||
|
@ -311,7 +311,7 @@ public interface MultiValuedMap<K, V> {
|
|||
// Iterators
|
||||
|
||||
/**
|
||||
* Obtains a <code>MapIterator</code> over this multi-valued map.
|
||||
* Obtains a {@code MapIterator} over this multi-valued map.
|
||||
* <p>
|
||||
* A map iterator is an efficient way of iterating over maps. There is no
|
||||
* need to access the entries collection or use {@code Map.Entry} objects.
|
||||
|
|
|
@ -38,11 +38,11 @@ public interface OrderedBidiMap<K, V> extends BidiMap<K, V>, OrderedMap<K, V> {
|
|||
* This enables both directions of the map to be accessed equally.
|
||||
* <p>
|
||||
* Implementations should seek to avoid creating a new object every time this
|
||||
* method is called. See <code>AbstractMap.values()</code> etc. Calling this
|
||||
* method is called. See {@code AbstractMap.values()} etc. Calling this
|
||||
* method on the inverse map should return the original.
|
||||
* <p>
|
||||
* Implementations must return an <code>OrderedBidiMap</code> instance,
|
||||
* usually by forwarding to <code>inverseOrderedBidiMap()</code>.
|
||||
* Implementations must return an {@code OrderedBidiMap} instance,
|
||||
* usually by forwarding to {@code inverseOrderedBidiMap()}.
|
||||
*
|
||||
* @return an inverted bidirectional map
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,7 @@ public interface OrderedIterator<E> extends Iterator<E> {
|
|||
/**
|
||||
* Checks to see if there is a previous element that can be iterated to.
|
||||
*
|
||||
* @return <code>true</code> if the iterator has a previous element
|
||||
* @return {@code true} if the iterator has a previous element
|
||||
*/
|
||||
boolean hasPrevious();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ package org.apache.commons.collections4;
|
|||
public interface OrderedMap<K, V> extends IterableMap<K, V> {
|
||||
|
||||
/**
|
||||
* Obtains an <code>OrderedMapIterator</code> over the map.
|
||||
* Obtains an {@code OrderedMapIterator} over the map.
|
||||
* <p>
|
||||
* A ordered map iterator is an efficient way of iterating over maps
|
||||
* in both directions.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package org.apache.commons.collections4;
|
||||
|
||||
/**
|
||||
* Defines an iterator that operates over an ordered <code>Map</code>.
|
||||
* Defines an iterator that operates over an ordered {@code Map}.
|
||||
* <p>
|
||||
* This iterator allows both forward and reverse iteration through the map.
|
||||
* </p>
|
||||
|
@ -31,13 +31,13 @@ public interface OrderedMapIterator<K, V> extends MapIterator<K, V>, OrderedIter
|
|||
/**
|
||||
* Checks to see if there is a previous entry that can be iterated to.
|
||||
*
|
||||
* @return <code>true</code> if the iterator has a previous element
|
||||
* @return {@code true} if the iterator has a previous element
|
||||
*/
|
||||
@Override
|
||||
boolean hasPrevious();
|
||||
|
||||
/**
|
||||
* Gets the previous <em>key</em> from the <code>Map</code>.
|
||||
* Gets the previous <em>key</em> from the {@code Map}.
|
||||
*
|
||||
* @return the previous key in the iteration
|
||||
* @throws java.util.NoSuchElementException if the iteration is finished
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.commons.collections4;
|
|||
* Defines a functor interface implemented by classes that perform a predicate
|
||||
* test on an object.
|
||||
* <p>
|
||||
* A <code>Predicate</code> is the object equivalent of an <code>if</code> statement.
|
||||
* A {@code Predicate} is the object equivalent of an {@code if} statement.
|
||||
* It uses the input object to return a true or false value, and is often used in
|
||||
* validation or filtering.
|
||||
* </p>
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.commons.collections4.functors.TruePredicate;
|
|||
import org.apache.commons.collections4.functors.UniquePredicate;
|
||||
|
||||
/**
|
||||
* <code>PredicateUtils</code> provides reference implementations and utilities
|
||||
* {@code PredicateUtils} provides reference implementations and utilities
|
||||
* for the Predicate functor interface. The supplied predicates are:
|
||||
* <ul>
|
||||
* <li>Invoker - returns the result of a method call on the input object
|
||||
|
@ -162,8 +162,8 @@ public class PredicateUtils {
|
|||
|
||||
/**
|
||||
* Creates a Predicate that checks if the object passed in is of
|
||||
* a particular type, using instanceof. A <code>null</code> input
|
||||
* object will return <code>false</code>.
|
||||
* a particular type, using instanceof. A {@code null} input
|
||||
* object will return {@code false}.
|
||||
*
|
||||
* @param type the type to check for, may not be null
|
||||
* @return the predicate
|
||||
|
@ -177,7 +177,7 @@ public class PredicateUtils {
|
|||
/**
|
||||
* Creates a Predicate that returns true the first time an object is
|
||||
* encountered, and false if the same object is received
|
||||
* again. The comparison is by equals(). A <code>null</code> input object
|
||||
* again. The comparison is by equals(). A {@code null} input object
|
||||
* is accepted and will return true the first time, and false subsequently
|
||||
* as well.
|
||||
*
|
||||
|
@ -196,8 +196,8 @@ public class PredicateUtils {
|
|||
* and have no parameters. If the input object is null, a
|
||||
* PredicateException is thrown.
|
||||
* <p>
|
||||
* For example, <code>PredicateUtils.invokerPredicate("isEmpty");</code>
|
||||
* will call the <code>isEmpty</code> method on the input object to
|
||||
* For example, {@code PredicateUtils.invokerPredicate("isEmpty");}
|
||||
* will call the {@code isEmpty} method on the input object to
|
||||
* determine the predicate result.
|
||||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
|
@ -218,8 +218,8 @@ public class PredicateUtils {
|
|||
* and have no parameters. If the input object is null, a
|
||||
* PredicateException is thrown.
|
||||
* <p>
|
||||
* For example, <code>PredicateUtils.invokerPredicate("isEmpty");</code>
|
||||
* will call the <code>isEmpty</code> method on the input object to
|
||||
* For example, {@code PredicateUtils.invokerPredicate("isEmpty");}
|
||||
* will call the {@code isEmpty} method on the input object to
|
||||
* determine the predicate result.
|
||||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
|
@ -248,7 +248,7 @@ public class PredicateUtils {
|
|||
* @param <T> the type that the predicate queries
|
||||
* @param predicate1 the first predicate, may not be null
|
||||
* @param predicate2 the second predicate, may not be null
|
||||
* @return the <code>and</code> predicate
|
||||
* @return the {@code and} predicate
|
||||
* @throws NullPointerException if either predicate is null
|
||||
* @see AndPredicate
|
||||
*/
|
||||
|
@ -264,7 +264,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates an array of predicates to check, may not be null
|
||||
* @return the <code>all</code> predicate
|
||||
* @return the {@code all} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
* @see AllPredicate
|
||||
|
@ -280,7 +280,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates a collection of predicates to check, may not be null
|
||||
* @return the <code>all</code> predicate
|
||||
* @return the {@code all} predicate
|
||||
* @throws NullPointerException if the predicates collection is null
|
||||
* @throws NullPointerException if any predicate in the collection is null
|
||||
* @see AllPredicate
|
||||
|
@ -296,7 +296,7 @@ public class PredicateUtils {
|
|||
* @param <T> the type that the predicate queries
|
||||
* @param predicate1 the first predicate, may not be null
|
||||
* @param predicate2 the second predicate, may not be null
|
||||
* @return the <code>or</code> predicate
|
||||
* @return the {@code or} predicate
|
||||
* @throws NullPointerException if either predicate is null
|
||||
* @see OrPredicate
|
||||
*/
|
||||
|
@ -312,7 +312,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates an array of predicates to check, may not be null
|
||||
* @return the <code>any</code> predicate
|
||||
* @return the {@code any} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
* @see AnyPredicate
|
||||
|
@ -328,7 +328,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates a collection of predicates to check, may not be null
|
||||
* @return the <code>any</code> predicate
|
||||
* @return the {@code any} predicate
|
||||
* @throws NullPointerException if the predicates collection is null
|
||||
* @throws NullPointerException if any predicate in the collection is null
|
||||
* @see AnyPredicate
|
||||
|
@ -344,7 +344,7 @@ public class PredicateUtils {
|
|||
* @param <T> the type that the predicate queries
|
||||
* @param predicate1 the first predicate, may not be null
|
||||
* @param predicate2 the second predicate, may not be null
|
||||
* @return the <code>either</code> predicate
|
||||
* @return the {@code either} predicate
|
||||
* @throws NullPointerException if either predicate is null
|
||||
* @see OnePredicate
|
||||
*/
|
||||
|
@ -362,7 +362,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates an array of predicates to check, may not be null
|
||||
* @return the <code>one</code> predicate
|
||||
* @return the {@code one} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
* @see OnePredicate
|
||||
|
@ -378,7 +378,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates a collection of predicates to check, may not be null
|
||||
* @return the <code>one</code> predicate
|
||||
* @return the {@code one} predicate
|
||||
* @throws NullPointerException if the predicates collection is null
|
||||
* @throws NullPointerException if any predicate in the collection is null
|
||||
* @see OnePredicate
|
||||
|
@ -394,7 +394,7 @@ public class PredicateUtils {
|
|||
* @param <T> the type that the predicate queries
|
||||
* @param predicate1 the first predicate, may not be null
|
||||
* @param predicate2 the second predicate, may not be null
|
||||
* @return the <code>neither</code> predicate
|
||||
* @return the {@code neither} predicate
|
||||
* @throws NullPointerException if either predicate is null
|
||||
* @see NonePredicate
|
||||
*/
|
||||
|
@ -412,7 +412,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates an array of predicates to check, may not be null
|
||||
* @return the <code>none</code> predicate
|
||||
* @return the {@code none} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
* @see NonePredicate
|
||||
|
@ -428,7 +428,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates a collection of predicates to check, may not be null
|
||||
* @return the <code>none</code> predicate
|
||||
* @return the {@code none} predicate
|
||||
* @throws NullPointerException if the predicates collection is null
|
||||
* @throws NullPointerException if any predicate in the collection is null
|
||||
* @see NonePredicate
|
||||
|
@ -443,7 +443,7 @@ public class PredicateUtils {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicate the predicate to not
|
||||
* @return the <code>not</code> predicate
|
||||
* @return the {@code not} predicate
|
||||
* @throws NullPointerException if the predicate is null
|
||||
* @see NotPredicate
|
||||
*/
|
||||
|
|
|
@ -47,11 +47,11 @@ public interface Put<K, V> {
|
|||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param value value to be associated with the specified key
|
||||
* @return the previous value associated with <code>key</code>, or
|
||||
* <code>null</code> if there was no mapping for <code>key</code>.
|
||||
* (A <code>null</code> return can also indicate that the map
|
||||
* previously associated <code>null</code> with <code>key</code>,
|
||||
* if the implementation supports <code>null</code> values.)
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key},
|
||||
* if the implementation supports {@code null} values.)
|
||||
* @see Map#put(Object, Object)
|
||||
*/
|
||||
Object put(K key, V value);
|
||||
|
|
|
@ -38,7 +38,7 @@ public class QueueUtils {
|
|||
public static final Queue EMPTY_QUEUE = UnmodifiableQueue.unmodifiableQueue(new LinkedList<>());
|
||||
|
||||
/**
|
||||
* <code>QueueUtils</code> should not normally be instantiated.
|
||||
* {@code QueueUtils} should not normally be instantiated.
|
||||
*/
|
||||
private QueueUtils() {}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class QueueUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get an empty <code>Queue</code>.
|
||||
* Get an empty {@code Queue}.
|
||||
*
|
||||
* @param <E> the type of the elements in the queue
|
||||
* @return an empty {@link Queue}
|
||||
|
|
|
@ -187,12 +187,12 @@ public class SetUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an immutable empty set if the argument is <code>null</code>,
|
||||
* Returns an immutable empty set if the argument is {@code null},
|
||||
* or the argument itself otherwise.
|
||||
*
|
||||
* @param <T> the element type
|
||||
* @param set the set, possibly <code>null</code>
|
||||
* @return an empty set if the argument is <code>null</code>
|
||||
* @param set the set, possibly {@code null}
|
||||
* @return an empty set if the argument is {@code null}
|
||||
*/
|
||||
public static <T> Set<T> emptyIfNull(final Set<T> set) {
|
||||
return set == null ? Collections.<T>emptySet() : set;
|
||||
|
@ -223,7 +223,7 @@ public class SetUtils {
|
|||
* Generates a hash code using the algorithm specified in
|
||||
* {@link java.util.Set#hashCode()}.
|
||||
* <p>
|
||||
* This method is useful for implementing <code>Set</code> when you cannot
|
||||
* This method is useful for implementing {@code Set} when you cannot
|
||||
* extend AbstractSet. The method takes Collection instances to enable other
|
||||
* collection types to use the Set implementation algorithm.
|
||||
*
|
||||
|
@ -294,10 +294,10 @@ public class SetUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests two sets for equality as per the <code>equals()</code> contract
|
||||
* Tests two sets for equality as per the {@code equals()} contract
|
||||
* in {@link java.util.Set#equals(java.lang.Object)}.
|
||||
* <p>
|
||||
* This method is useful for implementing <code>Set</code> when you cannot
|
||||
* This method is useful for implementing {@code Set} when you cannot
|
||||
* extend AbstractSet. The method takes Collection instances to enable other
|
||||
* collection types to use the Set implementation algorithm.
|
||||
* <p>
|
||||
|
@ -333,8 +333,8 @@ public class SetUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a new hash set that matches elements based on <code>==</code> not
|
||||
* <code>equals()</code>.
|
||||
* Returns a new hash set that matches elements based on {@code ==} not
|
||||
* {@code equals()}.
|
||||
* <p>
|
||||
* <strong>This set will violate the detail of various Set contracts.</strong>
|
||||
* As a general rule, don't compare this set to other sets. In particular, you can't
|
||||
|
@ -656,7 +656,7 @@ public class SetUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* <code>SetUtils</code> should not normally be instantiated.
|
||||
* {@code SetUtils} should not normally be instantiated.
|
||||
*/
|
||||
private SetUtils() {}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.commons.collections4;
|
|||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Defines a type of <code>Bag</code> that maintains a sorted order among
|
||||
* Defines a type of {@code Bag} that maintains a sorted order among
|
||||
* its unique representative members.
|
||||
*
|
||||
* @param <E> the type of elements in this bag
|
||||
|
|
|
@ -40,11 +40,11 @@ public interface SortedBidiMap<K, V> extends OrderedBidiMap<K, V>, SortedMap<K,
|
|||
* This enables both directions of the map to be accessed equally.
|
||||
* <p>
|
||||
* Implementations should seek to avoid creating a new object every time this
|
||||
* method is called. See <code>AbstractMap.values()</code> etc. Calling this
|
||||
* method is called. See {@code AbstractMap.values()} etc. Calling this
|
||||
* method on the inverse map should return the original.
|
||||
* <p>
|
||||
* Implementations must return a <code>SortedBidiMap</code> instance,
|
||||
* usually by forwarding to <code>inverseSortedBidiMap()</code>.
|
||||
* Implementations must return a {@code SortedBidiMap} instance,
|
||||
* usually by forwarding to {@code inverseSortedBidiMap()}.
|
||||
*
|
||||
* @return an inverted bidirectional map
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.commons.collections4.set.UnmodifiableSet;
|
|||
public class SplitMapUtils {
|
||||
|
||||
/**
|
||||
* <code>SplitMapUtils</code> should not normally be instantiated.
|
||||
* {@code SplitMapUtils} should not normally be instantiated.
|
||||
*/
|
||||
private SplitMapUtils() {}
|
||||
|
||||
|
@ -223,8 +223,8 @@ public class SplitMapUtils {
|
|||
|
||||
/**
|
||||
* Get the specified {@link Get} as an instance of {@link IterableMap}.
|
||||
* If <code>get</code> implements {@link IterableMap} directly, no conversion will take place.
|
||||
* If <code>get</code> implements {@link Map} but not {@link IterableMap} it will be decorated.
|
||||
* If {@code get} implements {@link IterableMap} directly, no conversion will take place.
|
||||
* If {@code get} implements {@link Map} but not {@link IterableMap} it will be decorated.
|
||||
* Otherwise an {@link Unmodifiable} {@link IterableMap} will be returned.
|
||||
* @param <K> the key type
|
||||
* @param <V> the value type
|
||||
|
@ -245,10 +245,10 @@ public class SplitMapUtils {
|
|||
|
||||
/**
|
||||
* Get the specified {@link Put} as an instanceof {@link Map}.
|
||||
* If <code>put</code> implements {@link Map} directly, no conversion will take place.
|
||||
* If {@code put} implements {@link Map} directly, no conversion will take place.
|
||||
* Otherwise a <em>write-only</em> {@link Map} will be returned. On such a {@link Map}
|
||||
* it is recommended that the result of #put(K, V) be discarded as it likely will not
|
||||
* match <code>V</code> at runtime.
|
||||
* match {@code V} at runtime.
|
||||
*
|
||||
* @param <K> the key type
|
||||
* @param <V> the element type
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.commons.collections4;
|
|||
* Defines a functor interface implemented by classes that transform one
|
||||
* object into another.
|
||||
* <p>
|
||||
* A <code>Transformer</code> converts the input object to the output object.
|
||||
* A {@code Transformer} converts the input object to the output object.
|
||||
* The input object should be left unchanged.
|
||||
* Transformers are typically used for type conversions, or extracting data
|
||||
* from an object.
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.commons.collections4.functors.StringValueTransformer;
|
|||
import org.apache.commons.collections4.functors.SwitchTransformer;
|
||||
|
||||
/**
|
||||
* <code>TransformerUtils</code> provides reference implementations and
|
||||
* {@code TransformerUtils} provides reference implementations and
|
||||
* utilities for the Transformer functor interface. The supplied transformers are:
|
||||
* <ul>
|
||||
* <li>Invoker - returns the result of a method call on the input object
|
||||
|
@ -55,7 +55,7 @@ import org.apache.commons.collections4.functors.SwitchTransformer;
|
|||
* <li>Null - always returns null
|
||||
* <li>NOP - returns the input object, which should be immutable
|
||||
* <li>Exception - always throws an exception
|
||||
* <li>StringValue - returns a <code>java.lang.String</code> representation of the input object
|
||||
* <li>StringValue - returns a {@code java.lang.String} representation of the input object
|
||||
* </ul>
|
||||
* <p>
|
||||
* Since v4.1 only transformers which are considered to be safe are
|
||||
|
@ -433,8 +433,8 @@ public class TransformerUtils {
|
|||
* {@code null} is returned.
|
||||
*
|
||||
* <p>
|
||||
* For example, <code>TransformerUtils.invokerTransformer("getName");</code>
|
||||
* will call the <code>getName</code> method on the input object to
|
||||
* For example, {@code TransformerUtils.invokerTransformer("getName");}
|
||||
* will call the {@code getName} method on the input object to
|
||||
* determine the transformer result.
|
||||
* </p>
|
||||
*
|
||||
|
@ -470,9 +470,9 @@ public class TransformerUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a transformer that returns a <code>java.lang.String</code>
|
||||
* Gets a transformer that returns a {@code java.lang.String}
|
||||
* representation of the input object. This is achieved via the
|
||||
* <code>toString</code> method, <code>null</code> returns 'null'.
|
||||
* {@code toString} method, {@code null} returns 'null'.
|
||||
*
|
||||
* @param <T> the input type
|
||||
* @return the transformer
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.collections4.Bag;
|
|||
import org.apache.commons.collections4.collection.AbstractCollectionDecorator;
|
||||
|
||||
/**
|
||||
* Decorates another <code>Bag</code> to provide additional behaviour.
|
||||
* Decorates another {@code Bag} to provide additional behaviour.
|
||||
* <p>
|
||||
* Methods are forwarded directly to the decorated bag.
|
||||
* </p>
|
||||
|
|
|
@ -135,7 +135,7 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
* Determines if the bag contains the given elements.
|
||||
*
|
||||
* @param coll the collection to check against
|
||||
* @return <code>true</code> if the Bag contains all the collection
|
||||
* @return {@code true} if the Bag contains all the collection
|
||||
*/
|
||||
@Override
|
||||
public boolean containsAll(final Collection<?> coll) {
|
||||
|
@ -146,11 +146,11 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the bag contains all elements in the given
|
||||
* Returns {@code true} if the bag contains all elements in the given
|
||||
* collection, respecting cardinality.
|
||||
*
|
||||
* @param other the bag to check against
|
||||
* @return <code>true</code> if the Bag contains all the collection
|
||||
* @return {@code true} if the Bag contains all the collection
|
||||
*/
|
||||
boolean containsAll(final Bag<?> other) {
|
||||
final Iterator<?> it = other.uniqueSet().iterator();
|
||||
|
@ -245,7 +245,7 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
* Adds a new element to the bag, incrementing its count in the underlying map.
|
||||
*
|
||||
* @param object the object to add
|
||||
* @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
|
||||
* @return {@code true} if the object was not already in the {@code uniqueSet}
|
||||
*/
|
||||
@Override
|
||||
public boolean add(final E object) {
|
||||
|
@ -257,7 +257,7 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
*
|
||||
* @param object the object to search for
|
||||
* @param nCopies the number of copies to add
|
||||
* @return <code>true</code> if the object was not already in the <code>uniqueSet</code>
|
||||
* @return {@code true} if the object was not already in the {@code uniqueSet}
|
||||
*/
|
||||
@Override
|
||||
public boolean add(final E object, final int nCopies) {
|
||||
|
@ -279,7 +279,7 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
* Invokes {@link #add(Object)} for each element in the given collection.
|
||||
*
|
||||
* @param coll the collection to add
|
||||
* @return <code>true</code> if this call changed the bag
|
||||
* @return {@code true} if this call changed the bag
|
||||
*/
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends E> coll) {
|
||||
|
@ -389,7 +389,7 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
* @see #retainAll(Collection)
|
||||
*
|
||||
* @param other the bag to retain
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
boolean retainAll(final Bag<?> other) {
|
||||
boolean result = false;
|
||||
|
@ -579,7 +579,7 @@ public abstract class AbstractMapBag<E> implements Bag<E> {
|
|||
* Gets a hash code for the Bag compatible with the definition of equals.
|
||||
* The hash code is defined as the sum total of a hash code for each
|
||||
* element. The per element hash code is defined as
|
||||
* <code>(e==null ? 0 : e.hashCode()) ^ noOccurances)</code>. This hash code
|
||||
* {@code (e==null ? 0 : e.hashCode()) ^ noOccurances)}. This hash code
|
||||
* is compatible with the Set interface.
|
||||
*
|
||||
* @return the hash code of the Bag
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Comparator;
|
|||
import org.apache.commons.collections4.SortedBag;
|
||||
|
||||
/**
|
||||
* Decorates another <code>SortedBag</code> to provide additional behaviour.
|
||||
* Decorates another {@code SortedBag} to provide additional behaviour.
|
||||
* <p>
|
||||
* Methods are forwarded directly to the decorated bag.
|
||||
* </p>
|
||||
|
|
|
@ -99,13 +99,13 @@ public final class CollectionBag<E> extends AbstractBagDecorator<E> {
|
|||
|
||||
/**
|
||||
* <i>(Change)</i>
|
||||
* Returns <code>true</code> if the bag contains all elements in
|
||||
* Returns {@code true} if the bag contains all elements in
|
||||
* the given collection, <b>not</b> respecting cardinality. That is,
|
||||
* if the given collection <code>coll</code> contains at least one of
|
||||
* if the given collection {@code coll} contains at least one of
|
||||
* every object contained in this object.
|
||||
*
|
||||
* @param coll the collection to check against
|
||||
* @return <code>true</code> if the Bag contains at least one of every object in the collection
|
||||
* @return {@code true} if the Bag contains at least one of every object in the collection
|
||||
*/
|
||||
@Override
|
||||
public boolean containsAll(final Collection<?> coll) {
|
||||
|
@ -123,10 +123,10 @@ public final class CollectionBag<E> extends AbstractBagDecorator<E> {
|
|||
* Adds one copy of the specified object to the Bag.
|
||||
* <p>
|
||||
* Since this method always increases the size of the bag, it
|
||||
* will always return <code>true</code>.
|
||||
* will always return {@code true}.
|
||||
*
|
||||
* @param object the object to add
|
||||
* @return <code>true</code>, always
|
||||
* @return {@code true}, always
|
||||
*/
|
||||
@Override
|
||||
public boolean add(final E object) {
|
||||
|
@ -152,7 +152,7 @@ public final class CollectionBag<E> extends AbstractBagDecorator<E> {
|
|||
* bag contains no occurrence anymore of the object after this operation.
|
||||
*
|
||||
* @param object the object to remove
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
public boolean remove(final Object object) {
|
||||
|
@ -166,7 +166,7 @@ public final class CollectionBag<E> extends AbstractBagDecorator<E> {
|
|||
* occurrences of every object contained in the given collection.
|
||||
*
|
||||
* @param coll the collection to remove
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
public boolean removeAll(final Collection<?> coll) {
|
||||
|
@ -188,18 +188,18 @@ public final class CollectionBag<E> extends AbstractBagDecorator<E> {
|
|||
* <i>(Change)</i>
|
||||
* Remove any members of the bag that are not in the given collection,
|
||||
* <i>not</i> respecting cardinality. That is, any object in the given
|
||||
* collection <code>coll</code> will be retained in the bag with the same
|
||||
* collection {@code coll} will be retained in the bag with the same
|
||||
* number of copies prior to this operation. All other objects will be
|
||||
* completely removed from this bag.
|
||||
* <p>
|
||||
* This implementation iterates over the elements of this bag, checking
|
||||
* each element in turn to see if it's contained in <code>coll</code>.
|
||||
* each element in turn to see if it's contained in {@code coll}.
|
||||
* If it's not contained, it's removed from this bag. As a consequence,
|
||||
* it is advised to use a collection type for <code>coll</code> that provides
|
||||
* it is advised to use a collection type for {@code coll} that provides
|
||||
* a fast (e.g. O(1)) implementation of {@link Collection#contains(Object)}.
|
||||
*
|
||||
* @param coll the collection to retain
|
||||
* @return <code>true</code> if this call changed the collection
|
||||
* @return {@code true} if this call changed the collection
|
||||
*/
|
||||
@Override
|
||||
public boolean retainAll(final Collection<?> coll) {
|
||||
|
@ -224,14 +224,14 @@ public final class CollectionBag<E> extends AbstractBagDecorator<E> {
|
|||
|
||||
/**
|
||||
* <i>(Change)</i>
|
||||
* Adds <code>count</code> copies of the specified object to the Bag.
|
||||
* Adds {@code count} copies of the specified object to the Bag.
|
||||
* <p>
|
||||
* Since this method always increases the size of the bag, it
|
||||
* will always return <code>true</code>.
|
||||
* will always return {@code true}.
|
||||
*
|
||||
* @param object the object to add
|
||||
* @param count the number of copies to add
|
||||
* @return <code>true</code>, always
|
||||
* @return {@code true}, always
|
||||
*/
|
||||
@Override
|
||||
public boolean add(final E object, final int count) {
|
||||
|
|
|
@ -77,7 +77,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
|||
transient Set<Map.Entry<K, V>> entrySet = null;
|
||||
|
||||
/**
|
||||
* Creates an empty map, initialised by <code>createMap</code>.
|
||||
* Creates an empty map, initialised by {@code createMap}.
|
||||
* <p>
|
||||
* This constructor remains in place for deserialization.
|
||||
* All other usage is deprecated in favour of
|
||||
|
@ -95,7 +95,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
|||
* <p>
|
||||
* Neither map is validated, so nulls may be passed in.
|
||||
* If you choose to do this then the subclass constructor must populate
|
||||
* the <code>maps[]</code> instance variable itself.
|
||||
* the {@code maps[]} instance variable itself.
|
||||
*
|
||||
* @param normalMap the normal direction map
|
||||
* @param reverseMap the reverse direction map
|
||||
|
@ -109,7 +109,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
|||
|
||||
/**
|
||||
* Constructs a map that decorates the specified maps,
|
||||
* used by the subclass <code>createBidiMap</code> implementation.
|
||||
* used by the subclass {@code createBidiMap} implementation.
|
||||
*
|
||||
* @param normalMap the normal direction map
|
||||
* @param reverseMap the reverse direction map
|
||||
|
@ -218,8 +218,8 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
|||
// BidiMap
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Obtains a <code>MapIterator</code> over the map.
|
||||
* The iterator implements <code>ResetableMapIterator</code>.
|
||||
* Obtains a {@code MapIterator} over the map.
|
||||
* The iterator implements {@code ResetableMapIterator}.
|
||||
* This implementation relies on the entrySet iterator.
|
||||
* <p>
|
||||
* The setValue() methods only allow a new value to be set.
|
||||
|
@ -411,9 +411,9 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
|
|||
* {@inheritDoc}
|
||||
* <p>
|
||||
* This implementation iterates over the elements of this bidi map, checking each element in
|
||||
* turn to see if it's contained in <code>coll</code>. If it's not contained, it's removed
|
||||
* turn to see if it's contained in {@code coll}. If it's not contained, it's removed
|
||||
* from this bidi map. As a consequence, it is advised to use a collection type for
|
||||
* <code>coll</code> that provides a fast (e.g. O(1)) implementation of
|
||||
* {@code coll} that provides a fast (e.g. O(1)) implementation of
|
||||
* {@link Collection#contains(Object)}.
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.commons.collections4.BidiMap;
|
|||
* </p>
|
||||
* <p>
|
||||
* NOTE: From Commons Collections 3.1, all subclasses will use {@link HashMap}
|
||||
* and the flawed <code>createMap</code> method is ignored.
|
||||
* and the flawed {@code createMap} method is ignored.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the type of the keys in the map
|
||||
|
@ -49,15 +49,15 @@ public class DualHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
|
|||
private static final long serialVersionUID = 721969328361808L;
|
||||
|
||||
/**
|
||||
* Creates an empty <code>HashBidiMap</code>.
|
||||
* Creates an empty {@code HashBidiMap}.
|
||||
*/
|
||||
public DualHashBidiMap() {
|
||||
super(new HashMap<K, V>(), new HashMap<V, K>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>HashBidiMap</code> and copies the mappings from
|
||||
* specified <code>Map</code>.
|
||||
* Constructs a {@code HashBidiMap} and copies the mappings from
|
||||
* specified {@code Map}.
|
||||
*
|
||||
* @param map the map whose mappings are to be placed in this map
|
||||
*/
|
||||
|
@ -67,7 +67,7 @@ public class DualHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>HashBidiMap</code> that decorates the specified maps.
|
||||
* Constructs a {@code HashBidiMap} that decorates the specified maps.
|
||||
*
|
||||
* @param normalMap the normal direction map
|
||||
* @param reverseMap the reverse direction map
|
||||
|
|
|
@ -26,9 +26,9 @@ import java.util.Map;
|
|||
import org.apache.commons.collections4.BidiMap;
|
||||
|
||||
/**
|
||||
* Implementation of <code>BidiMap</code> that uses two <code>LinkedHashMap</code> instances.
|
||||
* Implementation of {@code BidiMap} that uses two {@code LinkedHashMap} instances.
|
||||
* <p>
|
||||
* Two <code>LinkedHashMap</code> instances are used in this class.
|
||||
* Two {@code LinkedHashMap} instances are used in this class.
|
||||
* This provides fast lookups at the expense of storing two sets of map entries and two linked lists.
|
||||
* </p>
|
||||
*
|
||||
|
@ -43,15 +43,15 @@ public class DualLinkedHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> imple
|
|||
private static final long serialVersionUID = 721969328361810L;
|
||||
|
||||
/**
|
||||
* Creates an empty <code>HashBidiMap</code>.
|
||||
* Creates an empty {@code HashBidiMap}.
|
||||
*/
|
||||
public DualLinkedHashBidiMap() {
|
||||
super(new LinkedHashMap<K, V>(), new LinkedHashMap<V, K>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>LinkedHashBidiMap</code> and copies the mappings from
|
||||
* specified <code>Map</code>.
|
||||
* Constructs a {@code LinkedHashBidiMap} and copies the mappings from
|
||||
* specified {@code Map}.
|
||||
*
|
||||
* @param map the map whose mappings are to be placed in this map
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@ public class DualLinkedHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> imple
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>LinkedHashBidiMap</code> that decorates the specified maps.
|
||||
* Constructs a {@code LinkedHashBidiMap} that decorates the specified maps.
|
||||
*
|
||||
* @param normalMap the normal direction map
|
||||
* @param reverseMap the reverse direction map
|
||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.commons.collections4.map.AbstractSortedMapDecorator;
|
|||
* </p>
|
||||
* <p>
|
||||
* NOTE: From Commons Collections 3.1, all subclasses will use {@link TreeMap}
|
||||
* and the flawed <code>createMap</code> method is ignored.
|
||||
* and the flawed {@code createMap} method is ignored.
|
||||
* </p>
|
||||
*
|
||||
* @param <K> the type of the keys in this map
|
||||
|
@ -69,7 +69,7 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V>
|
|||
private final Comparator<? super V> valueComparator;
|
||||
|
||||
/**
|
||||
* Creates an empty <code>DualTreeBidiMap</code>
|
||||
* Creates an empty {@code DualTreeBidiMap}
|
||||
*/
|
||||
public DualTreeBidiMap() {
|
||||
super(new TreeMap<K, V>(), new TreeMap<V, K>());
|
||||
|
@ -78,8 +78,8 @@ public class DualTreeBidiMap<K, V> extends AbstractDualBidiMap<K, V>
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>DualTreeBidiMap</code> and copies the mappings from
|
||||
* specified <code>Map</code>.
|
||||
* Constructs a {@code DualTreeBidiMap} and copies the mappings from
|
||||
* specified {@code Map}.
|
||||
*
|
||||
* @param map the map whose mappings are to be placed in this map
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.commons.collections4.keyvalue.UnmodifiableMapEntry;
|
|||
|
||||
/**
|
||||
* Red-Black tree-based implementation of BidiMap where all objects added
|
||||
* implement the <code>Comparable</code> interface.
|
||||
* implement the {@code Comparable} interface.
|
||||
* <p>
|
||||
* This class guarantees that the map will be in both ascending key order
|
||||
* and ascending value order, sorted according to the natural order for
|
||||
|
@ -163,7 +163,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Checks whether this map contains the a mapping for the specified key.
|
||||
* <p>
|
||||
* The key must implement <code>Comparable</code>.
|
||||
* The key must implement {@code Comparable}.
|
||||
*
|
||||
* @param key key whose presence in this map is to be tested
|
||||
* @return true if this map contains a mapping for the specified key
|
||||
|
@ -179,7 +179,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Checks whether this map contains the a mapping for the specified value.
|
||||
* <p>
|
||||
* The value must implement <code>Comparable</code>.
|
||||
* The value must implement {@code Comparable}.
|
||||
*
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return true if this map contains a mapping for the specified value
|
||||
|
@ -196,7 +196,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
* Gets the value to which this map maps the specified key.
|
||||
* Returns null if the map contains no mapping for this key.
|
||||
* <p>
|
||||
* The key must implement <code>Comparable</code>.
|
||||
* The key must implement {@code Comparable}.
|
||||
*
|
||||
* @param key key whose associated value is to be returned
|
||||
* @return the value to which this map maps the specified key,
|
||||
|
@ -227,7 +227,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
* map.put("C","B"); // contains C mapped to B, key A is removed
|
||||
* </pre>
|
||||
* <p>
|
||||
* Both key and value must implement <code>Comparable</code>.
|
||||
* Both key and value must implement {@code Comparable}.
|
||||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param value value to be associated with the specified key
|
||||
|
@ -245,7 +245,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Puts all the mappings from the specified map into this map.
|
||||
* <p>
|
||||
* All keys and values must implement <code>Comparable</code>.
|
||||
* All keys and values must implement {@code Comparable}.
|
||||
*
|
||||
* @param map the map to copy from
|
||||
*/
|
||||
|
@ -259,7 +259,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Removes the mapping for this key from this map if present.
|
||||
* <p>
|
||||
* The key must implement <code>Comparable</code>.
|
||||
* The key must implement {@code Comparable}.
|
||||
*
|
||||
* @param key key whose mapping is to be removed from the map.
|
||||
* @return previous value associated with specified key,
|
||||
|
@ -289,7 +289,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
* Returns the key to which this map maps the specified value.
|
||||
* Returns null if the map contains no mapping for this value.
|
||||
* <p>
|
||||
* The value must implement <code>Comparable</code>.
|
||||
* The value must implement {@code Comparable}.
|
||||
*
|
||||
* @param value value whose associated key is to be returned.
|
||||
* @return the key to which this map maps the specified value,
|
||||
|
@ -307,7 +307,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Removes the mapping for this value from this map if present.
|
||||
* <p>
|
||||
* The value must implement <code>Comparable</code>.
|
||||
* The value must implement {@code Comparable}.
|
||||
*
|
||||
* @param value value whose mapping is to be removed from the map
|
||||
* @return previous key associated with specified value,
|
||||
|
@ -352,7 +352,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Gets the next key after the one specified.
|
||||
* <p>
|
||||
* The key must implement <code>Comparable</code>.
|
||||
* The key must implement {@code Comparable}.
|
||||
*
|
||||
* @param key the key to search for next from
|
||||
* @return the next key, null if no match or at end
|
||||
|
@ -367,7 +367,7 @@ public class TreeBidiMap<K extends Comparable<K>, V extends Comparable<V>>
|
|||
/**
|
||||
* Gets the previous key before the one specified.
|
||||
* <p>
|
||||
* The key must implement <code>Comparable</code>.
|
||||
* The key must implement {@code Comparable}.
|
||||
*
|
||||
* @param key the key to search for previous from
|
||||
* @return the previous key, null if no match or at start
|
||||
|
|
|
@ -23,13 +23,13 @@ import java.util.Objects;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Decorates another <code>Collection</code> to provide additional behaviour.
|
||||
* Decorates another {@code Collection} to provide additional behaviour.
|
||||
* <p>
|
||||
* Each method call made on this <code>Collection</code> is forwarded to the
|
||||
* decorated <code>Collection</code>. This class is used as a framework on which
|
||||
* Each method call made on this {@code Collection} is forwarded to the
|
||||
* decorated {@code Collection}. This class is used as a framework on which
|
||||
* to build to extensions such as synchronized and unmodifiable behaviour. The
|
||||
* main advantage of decoration is that one decorator can wrap any implementation
|
||||
* of <code>Collection</code>, whereas sub-classing requires a new class to be
|
||||
* of {@code Collection}, whereas sub-classing requires a new class to be
|
||||
* written for each implementation.
|
||||
* </p>
|
||||
* <p>
|
||||
|
|
|
@ -94,7 +94,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Gets the size of this composite collection.
|
||||
* <p>
|
||||
* This implementation calls <code>size()</code> on each collection.
|
||||
* This implementation calls {@code size()} on each collection.
|
||||
* </p>
|
||||
* @return total number of elements in all contained containers
|
||||
*/
|
||||
|
@ -110,7 +110,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Checks whether this composite collection is empty.
|
||||
* <p>
|
||||
* This implementation calls <code>isEmpty()</code> on each collection.
|
||||
* This implementation calls {@code isEmpty()} on each collection.
|
||||
* </p>
|
||||
* @return true if all of the contained collections are empty
|
||||
*/
|
||||
|
@ -127,7 +127,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Checks whether this composite collection contains the object.
|
||||
* <p>
|
||||
* This implementation calls <code>contains()</code> on each collection.
|
||||
* This implementation calls {@code contains()} on each collection.
|
||||
* </p>
|
||||
* @param obj the object to search for
|
||||
* @return true if obj is contained in any of the contained collections
|
||||
|
@ -145,10 +145,10 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Gets an iterator over all the collections in this composite.
|
||||
* <p>
|
||||
* This implementation uses an <code>IteratorChain</code>.
|
||||
* This implementation uses an {@code IteratorChain}.
|
||||
* </p>
|
||||
* @return an <code>IteratorChain</code> instance which supports
|
||||
* <code>remove()</code>. Iteration occurs over contained collections in
|
||||
* @return an {@code IteratorChain} instance which supports
|
||||
* {@code remove()}. Iteration occurs over contained collections in
|
||||
* the order they were added, but this behavior should not be relied upon.
|
||||
* @see IteratorChain
|
||||
*/
|
||||
|
@ -181,7 +181,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Returns an object array, populating the supplied array if possible.
|
||||
* See <code>Collection</code> interface for full details.
|
||||
* See {@code Collection} interface for full details.
|
||||
*
|
||||
* @param <T> the type of the elements in the collection
|
||||
* @param array the array to use, populating if possible
|
||||
|
@ -254,7 +254,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Checks whether this composite contains all the elements in the specified collection.
|
||||
* <p>
|
||||
* This implementation calls <code>contains()</code> for each element in the
|
||||
* This implementation calls {@code contains()} for each element in the
|
||||
* specified collection.
|
||||
* </p>
|
||||
* @param coll the collection to check for
|
||||
|
@ -297,7 +297,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Removes the elements in the specified collection from this composite collection.
|
||||
* <p>
|
||||
* This implementation calls <code>removeAll</code> on each collection.
|
||||
* This implementation calls {@code removeAll} on each collection.
|
||||
* </p>
|
||||
* @param coll the collection to remove
|
||||
* @return true if the collection was modified
|
||||
|
@ -318,7 +318,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Removes all of the elements of this collection that satisfy the given predicate from this composite collection.
|
||||
* <p>
|
||||
* This implementation calls <code>removeIf</code> on each collection.
|
||||
* This implementation calls {@code removeIf} on each collection.
|
||||
* </p>
|
||||
* @param filter a predicate which returns true for elements to be removed
|
||||
* @return true if the collection was modified
|
||||
|
@ -341,7 +341,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
* Retains all the elements in the specified collection in this composite collection,
|
||||
* removing all others.
|
||||
* <p>
|
||||
* This implementation calls <code>retainAll()</code> on each collection.
|
||||
* This implementation calls {@code retainAll()} on each collection.
|
||||
* </p>
|
||||
* @param coll the collection to remove
|
||||
* @return true if the collection was modified
|
||||
|
@ -361,7 +361,7 @@ public class CompositeCollection<E> implements Collection<E>, Serializable {
|
|||
/**
|
||||
* Removes all of the elements from this collection .
|
||||
* <p>
|
||||
* This implementation calls <code>clear()</code> on each collection.
|
||||
* This implementation calls {@code clear()} on each collection.
|
||||
* </p>
|
||||
* @throws UnsupportedOperationException if clear is unsupported
|
||||
*/
|
||||
|
|
|
@ -55,7 +55,7 @@ public final class UnmodifiableBoundedCollection<E> extends AbstractCollectionDe
|
|||
* Factory method to create an unmodifiable bounded collection.
|
||||
*
|
||||
* @param <E> the type of the elements in the collection
|
||||
* @param coll the <code>BoundedCollection</code> to decorate, must not be null
|
||||
* @param coll the {@code BoundedCollection} to decorate, must not be null
|
||||
* @return a new unmodifiable bounded collection
|
||||
* @throws NullPointerException if {@code coll} is {@code null}
|
||||
* @since 4.0
|
||||
|
@ -76,7 +76,7 @@ public final class UnmodifiableBoundedCollection<E> extends AbstractCollectionDe
|
|||
* to find a suitable BoundedCollection.
|
||||
*
|
||||
* @param <E> the type of the elements in the collection
|
||||
* @param collection the <code>BoundedCollection</code> to decorate, must not be null
|
||||
* @param collection the {@code BoundedCollection} to decorate, must not be null
|
||||
* @return a new unmodifiable bounded collection
|
||||
* @throws NullPointerException if coll is null
|
||||
* @throws IllegalArgumentException if coll is not a {@code BoundedCollection}
|
||||
|
|
|
@ -40,13 +40,13 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
/** Constant "false first" reference. */
|
||||
private static final BooleanComparator FALSE_FIRST = new BooleanComparator(false);
|
||||
|
||||
/** <code>true</code> iff <code>true</code> values sort before <code>false</code> values. */
|
||||
/** {@code true} iff {@code true} values sort before {@code false} values. */
|
||||
private boolean trueFirst = false;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns a BooleanComparator instance that sorts
|
||||
* <code>true</code> values before <code>false</code> values.
|
||||
* {@code true} values before {@code false} values.
|
||||
* <p>
|
||||
* Clients are encouraged to use the value returned from
|
||||
* this method instead of constructing a new instance
|
||||
|
@ -63,7 +63,7 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
|
||||
/**
|
||||
* Returns a BooleanComparator instance that sorts
|
||||
* <code>false</code> values before <code>true</code> values.
|
||||
* {@code false} values before {@code true} values.
|
||||
* <p>
|
||||
* Clients are encouraged to use the value returned from
|
||||
* this method instead of constructing a new instance
|
||||
|
@ -80,8 +80,8 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
|
||||
/**
|
||||
* Returns a BooleanComparator instance that sorts
|
||||
* <code><i>trueFirst</i></code> values before
|
||||
* <code>!<i>trueFirst</i></code> values.
|
||||
* {@code <i>trueFirst</i>} values before
|
||||
* {@code !<i>trueFirst</i>} values.
|
||||
* <p>
|
||||
* Clients are encouraged to use the value returned from
|
||||
* this method instead of constructing a new instance
|
||||
|
@ -90,8 +90,8 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
* virtual machine.
|
||||
* </p>
|
||||
*
|
||||
* @param trueFirst when <code>true</code>, sort
|
||||
* <code>true</code> <code>Boolean</code>s before <code>false</code>
|
||||
* @param trueFirst when {@code true}, sort
|
||||
* {@code true} {@code Boolean}s before {@code false}
|
||||
* @return a singleton BooleanComparator instance
|
||||
* @since 4.0
|
||||
*/
|
||||
|
@ -101,8 +101,8 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Creates a <code>BooleanComparator</code> that sorts
|
||||
* <code>false</code> values before <code>true</code> values.
|
||||
* Creates a {@code BooleanComparator} that sorts
|
||||
* {@code false} values before {@code true} values.
|
||||
* <p>
|
||||
* Equivalent to {@link #BooleanComparator(boolean) BooleanComparator(false)}.
|
||||
* <p>
|
||||
|
@ -113,14 +113,14 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>BooleanComparator</code> that sorts
|
||||
* <code><i>trueFirst</i></code> values before
|
||||
* <code>!<i>trueFirst</i></code> values.
|
||||
* Creates a {@code BooleanComparator} that sorts
|
||||
* {@code <i>trueFirst</i>} values before
|
||||
* {@code !<i>trueFirst</i>} values.
|
||||
* <p>
|
||||
* Please use the static factories instead whenever possible.
|
||||
*
|
||||
* @param trueFirst when <code>true</code>, sort
|
||||
* <code>true</code> boolean values before <code>false</code>
|
||||
* @param trueFirst when {@code true}, sort
|
||||
* {@code true} boolean values before {@code false}
|
||||
*/
|
||||
public BooleanComparator(final boolean trueFirst) {
|
||||
this.trueFirst = trueFirst;
|
||||
|
@ -128,13 +128,13 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Compares two non-<code>null</code> <code>Boolean</code> objects
|
||||
* Compares two non-{@code null} {@code Boolean} objects
|
||||
* according to the value of {@link #sortsTrueFirst()}.
|
||||
*
|
||||
* @param b1 the first boolean to compare
|
||||
* @param b2 the second boolean to compare
|
||||
* @return negative if obj1 is less, positive if greater, zero if equal
|
||||
* @throws NullPointerException when either argument <code>null</code>
|
||||
* @throws NullPointerException when either argument {@code null}
|
||||
*/
|
||||
@Override
|
||||
public int compare(final Boolean b1, final Boolean b2) {
|
||||
|
@ -158,12 +158,12 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff <i>that</i> Object is
|
||||
* Returns {@code true} iff <i>that</i> Object is
|
||||
* is a {@link Comparator} whose ordering is known to be
|
||||
* equivalent to mine.
|
||||
* <p>
|
||||
* This implementation returns <code>true</code>
|
||||
* iff <code><i>that</i></code> is a {@link BooleanComparator}
|
||||
* This implementation returns {@code true}
|
||||
* iff {@code <i>that</i>} is a {@link BooleanComparator}
|
||||
* whose value of {@link #sortsTrueFirst()} is equal to mine.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
|
@ -178,10 +178,10 @@ public final class BooleanComparator implements Comparator<Boolean>, Serializabl
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Returns <code>true</code> iff
|
||||
* I sort <code>true</code> values before
|
||||
* <code>false</code> values. In other words,
|
||||
* returns <code>true</code> iff
|
||||
* Returns {@code true} iff
|
||||
* I sort {@code true} values before
|
||||
* {@code false} values. In other words,
|
||||
* returns {@code true} iff
|
||||
* {@link #compare(Boolean,Boolean) compare(Boolean.FALSE,Boolean.TRUE)}
|
||||
* returns a positive value.
|
||||
*
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.util.Comparator;
|
|||
* <p>
|
||||
* Note: In the 2.0 and 2.1 releases of Commons Collections, this class would
|
||||
* throw a {@link ClassCastException} if either of the arguments to
|
||||
* {@link #compare(Object, Object) compare} were <code>null</code>, not
|
||||
* {@link #compare(Object, Object) compare} were {@code null}, not
|
||||
* {@link Comparable Comparable}, or for which
|
||||
* {@link Comparable#compareTo(Object) compareTo} gave inconsistent results.
|
||||
* This is no longer the case. See {@link #compare(Object, Object) compare} for
|
||||
|
@ -86,10 +86,10 @@ public class ComparableComparator<E extends Comparable<? super E>> implements Co
|
|||
* @param obj1 the first object to compare
|
||||
* @param obj2 the second object to compare
|
||||
* @return negative if obj1 is less, positive if greater, zero if equal
|
||||
* @throws NullPointerException if <i>obj1</i> is <code>null</code>,
|
||||
* or when <code>((Comparable)obj1).compareTo(obj2)</code> does
|
||||
* @throws ClassCastException if <i>obj1</i> is not a <code>Comparable</code>,
|
||||
* or when <code>((Comparable)obj1).compareTo(obj2)</code> does
|
||||
* @throws NullPointerException if <i>obj1</i> is {@code null},
|
||||
* or when {@code ((Comparable)obj1).compareTo(obj2)} does
|
||||
* @throws ClassCastException if <i>obj1</i> is not a {@code Comparable},
|
||||
* or when {@code ((Comparable)obj1).compareTo(obj2)} does
|
||||
*/
|
||||
@Override
|
||||
public int compare(final E obj1, final E obj2) {
|
||||
|
@ -114,8 +114,8 @@ public class ComparableComparator<E extends Comparable<? super E>> implements Co
|
|||
* whose ordering is known to be equivalent to mine.
|
||||
* <p>
|
||||
* This implementation returns {@code true} iff
|
||||
* <code><i>object</i>.{@link Object#getClass() getClass()}</code> equals
|
||||
* <code>this.getClass()</code>. Subclasses may want to override this behavior to remain
|
||||
* {@code <i>object</i>.{@link Object#getClass() getClass()}} equals
|
||||
* {@code this.getClass()}. Subclasses may want to override this behavior to remain
|
||||
* consistent with the {@link Comparator#equals(Object)} contract.
|
||||
*
|
||||
* @param object the object to compare with
|
||||
|
|
|
@ -317,13 +317,13 @@ public class ComparatorChain<E> implements Comparator<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff <i>that</i> Object is
|
||||
* Returns {@code true} iff <i>that</i> Object is
|
||||
* is a {@link Comparator} whose ordering is known to be
|
||||
* equivalent to mine.
|
||||
* <p>
|
||||
* This implementation returns <code>true</code>
|
||||
* iff <code><i>object</i>.{@link Object#getClass() getClass()}</code>
|
||||
* equals <code>this.getClass()</code>, and the underlying
|
||||
* This implementation returns {@code true}
|
||||
* iff {@code <i>object</i>.{@link Object#getClass() getClass()}}
|
||||
* equals {@code this.getClass()}, and the underlying
|
||||
* comparators and order bits are equal.
|
||||
* Subclasses may want to override this behavior to remain consistent
|
||||
* with the {@link Comparator#equals(Object)} contract.
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Objects;
|
|||
* Arrays.sort(planets, distanceFromSun); // Back to original order
|
||||
* </pre>
|
||||
* <p>
|
||||
* Once <code>compare</code> has been called, the FixedOrderComparator is locked
|
||||
* Once {@code compare} has been called, the FixedOrderComparator is locked
|
||||
* and attempts to modify it yield an UnsupportedOperationException.
|
||||
* </p>
|
||||
* <p>
|
||||
|
@ -260,12 +260,12 @@ public class FixedOrderComparator<T> implements Comparator<T>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff <i>that</i> Object is
|
||||
* Returns {@code true} iff <i>that</i> Object is
|
||||
* is a {@link Comparator} whose ordering is known to be
|
||||
* equivalent to mine.
|
||||
* <p>
|
||||
* This implementation returns <code>true</code>
|
||||
* iff <code><i>that</i></code> is a {@link FixedOrderComparator}
|
||||
* This implementation returns {@code true}
|
||||
* iff {@code <i>that</i>} is a {@link FixedOrderComparator}
|
||||
* whose attributes are equal to mine.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
|
|
|
@ -35,21 +35,21 @@ public class NullComparator<E> implements Comparator<E>, Serializable {
|
|||
private static final long serialVersionUID = -5820772575483504339L;
|
||||
|
||||
/**
|
||||
* The comparator to use when comparing two non-<code>null</code> objects.
|
||||
* The comparator to use when comparing two non-{@code null} objects.
|
||||
**/
|
||||
private final Comparator<? super E> nonNullComparator;
|
||||
|
||||
/**
|
||||
* Specifies whether a <code>null</code> are compared as higher than
|
||||
* non-<code>null</code> objects.
|
||||
* Specifies whether a {@code null} are compared as higher than
|
||||
* non-{@code null} objects.
|
||||
**/
|
||||
private final boolean nullsAreHigh;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Construct an instance that sorts <code>null</code> higher than any
|
||||
* non-<code>null</code> object it is compared with. When comparing two
|
||||
* non-<code>null</code> objects, the {@link ComparableComparator} is
|
||||
* Construct an instance that sorts {@code null} higher than any
|
||||
* non-{@code null} object it is compared with. When comparing two
|
||||
* non-{@code null} objects, the {@link ComparableComparator} is
|
||||
* used.
|
||||
**/
|
||||
public NullComparator() {
|
||||
|
@ -57,56 +57,56 @@ public class NullComparator<E> implements Comparator<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Construct an instance that sorts <code>null</code> higher than any
|
||||
* non-<code>null</code> object it is compared with. When comparing two
|
||||
* non-<code>null</code> objects, the specified {@link Comparator} is
|
||||
* Construct an instance that sorts {@code null} higher than any
|
||||
* non-{@code null} object it is compared with. When comparing two
|
||||
* non-{@code null} objects, the specified {@link Comparator} is
|
||||
* used.
|
||||
*
|
||||
* @param nonNullComparator the comparator to use when comparing two
|
||||
* non-<code>null</code> objects. This argument cannot be
|
||||
* <code>null</code>
|
||||
* non-{@code null} objects. This argument cannot be
|
||||
* {@code null}
|
||||
*
|
||||
* @throws NullPointerException if <code>nonNullComparator</code> is
|
||||
* <code>null</code>
|
||||
* @throws NullPointerException if {@code nonNullComparator} is
|
||||
* {@code null}
|
||||
**/
|
||||
public NullComparator(final Comparator<? super E> nonNullComparator) {
|
||||
this(nonNullComparator, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance that sorts <code>null</code> higher or lower than
|
||||
* any non-<code>null</code> object it is compared with. When comparing
|
||||
* two non-<code>null</code> objects, the {@link ComparableComparator} is
|
||||
* Construct an instance that sorts {@code null} higher or lower than
|
||||
* any non-{@code null} object it is compared with. When comparing
|
||||
* two non-{@code null} objects, the {@link ComparableComparator} is
|
||||
* used.
|
||||
*
|
||||
* @param nullsAreHigh a <code>true</code> value indicates that
|
||||
* <code>null</code> should be compared as higher than a
|
||||
* non-<code>null</code> object. A <code>false</code> value indicates
|
||||
* that <code>null</code> should be compared as lower than a
|
||||
* non-<code>null</code> object.
|
||||
* @param nullsAreHigh a {@code true} value indicates that
|
||||
* {@code null} should be compared as higher than a
|
||||
* non-{@code null} object. A {@code false} value indicates
|
||||
* that {@code null} should be compared as lower than a
|
||||
* non-{@code null} object.
|
||||
**/
|
||||
public NullComparator(final boolean nullsAreHigh) {
|
||||
this(ComparatorUtils.NATURAL_COMPARATOR, nullsAreHigh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance that sorts <code>null</code> higher or lower than
|
||||
* any non-<code>null</code> object it is compared with. When comparing
|
||||
* two non-<code>null</code> objects, the specified {@link Comparator} is
|
||||
* Construct an instance that sorts {@code null} higher or lower than
|
||||
* any non-{@code null} object it is compared with. When comparing
|
||||
* two non-{@code null} objects, the specified {@link Comparator} is
|
||||
* used.
|
||||
*
|
||||
* @param nonNullComparator the comparator to use when comparing two
|
||||
* non-<code>null</code> objects. This argument cannot be
|
||||
* <code>null</code>
|
||||
* non-{@code null} objects. This argument cannot be
|
||||
* {@code null}
|
||||
*
|
||||
* @param nullsAreHigh a <code>true</code> value indicates that
|
||||
* <code>null</code> should be compared as higher than a
|
||||
* non-<code>null</code> object. A <code>false</code> value indicates
|
||||
* that <code>null</code> should be compared as lower than a
|
||||
* non-<code>null</code> object.
|
||||
* @param nullsAreHigh a {@code true} value indicates that
|
||||
* {@code null} should be compared as higher than a
|
||||
* non-{@code null} object. A {@code false} value indicates
|
||||
* that {@code null} should be compared as lower than a
|
||||
* non-{@code null} object.
|
||||
*
|
||||
* @throws NullPointerException if <code>nonNullComparator</code> is
|
||||
* <code>null</code>
|
||||
* @throws NullPointerException if {@code nonNullComparator} is
|
||||
* {@code null}
|
||||
**/
|
||||
public NullComparator(final Comparator<? super E> nonNullComparator, final boolean nullsAreHigh) {
|
||||
this.nonNullComparator = Objects.requireNonNull(nonNullComparator, "nonNullComparator");
|
||||
|
@ -116,19 +116,19 @@ public class NullComparator<E> implements Comparator<E>, Serializable {
|
|||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Perform a comparison between two objects. If both objects are
|
||||
* <code>null</code>, a <code>0</code> value is returned. If one object
|
||||
* is <code>null</code> and the other is not, the result is determined on
|
||||
* {@code null}, a {@code 0} value is returned. If one object
|
||||
* is {@code null} and the other is not, the result is determined on
|
||||
* whether the Comparator was constructed to have nulls as higher or lower
|
||||
* than other objects. If neither object is <code>null</code>, an
|
||||
* than other objects. If neither object is {@code null}, an
|
||||
* underlying comparator specified in the constructor (or the default) is
|
||||
* used to compare the non-<code>null</code> objects.
|
||||
* used to compare the non-{@code null} objects.
|
||||
*
|
||||
* @param o1 the first object to compare
|
||||
* @param o2 the object to compare it to.
|
||||
* @return <code>-1</code> if <code>o1</code> is "lower" than (less than,
|
||||
* before, etc.) <code>o2</code>; <code>1</code> if <code>o1</code> is
|
||||
* "higher" than (greater than, after, etc.) <code>o2</code>; or
|
||||
* <code>0</code> if <code>o1</code> and <code>o2</code> are equal.
|
||||
* @return {@code -1} if {@code o1} is "lower" than (less than,
|
||||
* before, etc.) {@code o2}; {@code 1} if {@code o1} is
|
||||
* "higher" than (greater than, after, etc.) {@code o2}; or
|
||||
* {@code 0} if {@code o1} and {@code o2} are equal.
|
||||
**/
|
||||
@Override
|
||||
public int compare(final E o1, final E o2) {
|
||||
|
@ -156,10 +156,10 @@ public class NullComparator<E> implements Comparator<E>, Serializable {
|
|||
*
|
||||
* @param obj the object to compare this comparator with.
|
||||
*
|
||||
* @return <code>true</code> if the specified object is a NullComparator
|
||||
* with equivalent <code>null</code> comparison behavior
|
||||
* (i.e. <code>null</code> high or low) and with equivalent underlying
|
||||
* non-<code>null</code> object comparators.
|
||||
* @return {@code true} if the specified object is a NullComparator
|
||||
* with equivalent {@code null} comparison behavior
|
||||
* (i.e. {@code null} high or low) and with equivalent underlying
|
||||
* non-{@code null} object comparators.
|
||||
**/
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ReverseComparator<E> implements Comparator<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Creates a comparator that inverts the comparison
|
||||
* of the given comparator. If you pass in <code>null</code>,
|
||||
* of the given comparator. If you pass in {@code null},
|
||||
* the ReverseComparator defaults to reversing the
|
||||
* natural order, as per {@link java.util.Collections#reverseOrder()}.
|
||||
*
|
||||
|
@ -90,13 +90,13 @@ public class ReverseComparator<E> implements Comparator<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff <i>that</i> Object is
|
||||
* Returns {@code true} iff <i>that</i> Object is
|
||||
* is a {@link Comparator} whose ordering is known to be
|
||||
* equivalent to mine.
|
||||
* <p>
|
||||
* This implementation returns <code>true</code>
|
||||
* iff <code><i>object</i>.{@link Object#getClass() getClass()}</code>
|
||||
* equals <code>this.getClass()</code>, and the underlying
|
||||
* This implementation returns {@code true}
|
||||
* iff {@code <i>object</i>.{@link Object#getClass() getClass()}}
|
||||
* equals {@code this.getClass()}, and the underlying
|
||||
* comparators are equal.
|
||||
* Subclasses may want to override this behavior to remain consistent
|
||||
* with the {@link Comparator#equals(Object) equals} contract.
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TransformingComparator<I, O> implements Comparator<I>, Serializable
|
|||
* Constructs an instance with the given Transformer and a
|
||||
* {@link ComparableComparator ComparableComparator}.
|
||||
*
|
||||
* @param transformer what will transform the arguments to <code>compare</code>
|
||||
* @param transformer what will transform the arguments to {@code compare}
|
||||
*/
|
||||
public TransformingComparator(final Transformer<? super I, ? extends O> transformer) {
|
||||
this(transformer, ComparatorUtils.NATURAL_COMPARATOR);
|
||||
|
@ -62,7 +62,7 @@ public class TransformingComparator<I, O> implements Comparator<I>, Serializable
|
|||
/**
|
||||
* Constructs an instance with the given Transformer and Comparator.
|
||||
*
|
||||
* @param transformer what will transform the arguments to <code>compare</code>
|
||||
* @param transformer what will transform the arguments to {@code compare}
|
||||
* @param decorated the decorated Comparator
|
||||
*/
|
||||
public TransformingComparator(final Transformer<? super I, ? extends O> transformer,
|
||||
|
@ -102,12 +102,12 @@ public class TransformingComparator<I, O> implements Comparator<I>, Serializable
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> iff <i>that</i> Object is
|
||||
* Returns {@code true} iff <i>that</i> Object is
|
||||
* is a {@link Comparator} whose ordering is known to be
|
||||
* equivalent to mine.
|
||||
* <p>
|
||||
* This implementation returns <code>true</code>
|
||||
* iff <code><i>that</i></code> is a {@link TransformingComparator}
|
||||
* This implementation returns {@code true}
|
||||
* iff {@code <i>that</i>} is a {@link TransformingComparator}
|
||||
* whose attributes are equal to mine.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class AllPredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>all</code> predicate
|
||||
* @return the {@code all} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -72,7 +72,7 @@ public final class AllPredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>all</code> predicate
|
||||
* @return the {@code all} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ public final class AllPredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>allPredicate</code> if you want that.
|
||||
* Use {@code allPredicate} if you want that.
|
||||
*
|
||||
* @param predicates the predicates to check, not cloned, not null
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class AndPredicate<T> implements PredicateDecorator<T>, Serializabl
|
|||
* @param <T> the type that the predicate queries
|
||||
* @param predicate1 the first predicate to check, not null
|
||||
* @param predicate2 the second predicate to check, not null
|
||||
* @return the <code>and</code> predicate
|
||||
* @return the {@code and} predicate
|
||||
* @throws NullPointerException if either predicate is null
|
||||
*/
|
||||
public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1,
|
||||
|
@ -53,7 +53,7 @@ public final class AndPredicate<T> implements PredicateDecorator<T>, Serializabl
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>andPredicate</code> if you want that.
|
||||
* Use {@code andPredicate} if you want that.
|
||||
*
|
||||
* @param predicate1 the first predicate to check, not null
|
||||
* @param predicate2 the second predicate to check, not null
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class AnyPredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>any</code> predicate
|
||||
* @return the {@code any} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -68,7 +68,7 @@ public final class AnyPredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>all</code> predicate
|
||||
* @return the {@code all} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -86,7 +86,7 @@ public final class AnyPredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>anyPredicate</code> if you want that.
|
||||
* Use {@code anyPredicate} if you want that.
|
||||
*
|
||||
* @param predicates the predicates to check, not cloned, not null
|
||||
*/
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param closures the closures to chain, copied, no nulls
|
||||
* @return the <code>chained</code> closure
|
||||
* @return the {@code chained} closure
|
||||
* @throws NullPointerException if the closures array is null
|
||||
* @throws NullPointerException if any closure in the array is null
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param closures a collection of closures to chain
|
||||
* @return the <code>chained</code> closure
|
||||
* @return the {@code chained} closure
|
||||
* @throws NullPointerException if the closures collection is null
|
||||
* @throws NullPointerException if any closure in the collection is null
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class ChainedClosure<E> implements Closure<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>chainedClosure</code> if you want that.
|
||||
* Use {@code chainedClosure} if you want that.
|
||||
*
|
||||
* @param closures the closures to chain, copied, no nulls
|
||||
*/
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ChainedTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
*
|
||||
* @param <T> the object type
|
||||
* @param transformers the transformers to chain, copied, no nulls
|
||||
* @return the <code>chained</code> transformer
|
||||
* @return the {@code chained} transformer
|
||||
* @throws NullPointerException if the transformers array is null
|
||||
* @throws NullPointerException if any transformer in the array is null
|
||||
*/
|
||||
|
@ -63,7 +63,7 @@ public class ChainedTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
*
|
||||
* @param <T> the object type
|
||||
* @param transformers a collection of transformers to chain
|
||||
* @return the <code>chained</code> transformer
|
||||
* @return the {@code chained} transformer
|
||||
* @throws NullPointerException if the transformers collection is null
|
||||
* @throws NullPointerException if any transformer in the collection is null
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class ChainedTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>chainedTransformer</code> if you want that.
|
||||
* Use {@code chainedTransformer} if you want that.
|
||||
*
|
||||
* @param transformers the transformers to chain, copied, no nulls
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.commons.collections4.Transformer;
|
|||
/**
|
||||
* Transformer implementation that returns a clone of the input object.
|
||||
* <p>
|
||||
* Clone is performed using <code>PrototypeFactory.prototypeFactory(input).create()</code>.
|
||||
* Clone is performed using {@code PrototypeFactory.prototypeFactory(input).create()}.
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>WARNING:</b> from v4.1 onwards this class will <b>not</b> be serializable anymore
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ClosureTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
*
|
||||
* @param <T> the type of the object to transform
|
||||
* @param closure the closure to call, not null
|
||||
* @return the <code>closure</code> transformer
|
||||
* @return the {@code closure} transformer
|
||||
* @throws NullPointerException if the closure is null
|
||||
*/
|
||||
public static <T> Transformer<T, T> closureTransformer(final Closure<? super T> closure) {
|
||||
|
@ -50,7 +50,7 @@ public class ClosureTransformer<T> implements Transformer<T, T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>closureTransformer</code> if you want that.
|
||||
* Use {@code closureTransformer} if you want that.
|
||||
*
|
||||
* @param closure the closure to call, not null
|
||||
*/
|
||||
|
|
|
@ -41,16 +41,16 @@ import org.apache.commons.collections4.Predicate;
|
|||
* };
|
||||
* </pre>
|
||||
*
|
||||
* <p>Using the declared variables, the <code>ComparatorPredicate</code> can be used used in the
|
||||
* <p>Using the declared variables, the {@code ComparatorPredicate} can be used used in the
|
||||
* following way:</p>
|
||||
*
|
||||
* <pre>
|
||||
* ComparatorPredicate.comparatorPredicate(ONE, comparator).evaluate(TWO);
|
||||
* </pre>
|
||||
*
|
||||
* <p>The input variable <code>TWO</code> in compared to the stored variable <code>ONE</code> using
|
||||
* the supplied <code>comparator</code>. This is the default usage of the predicate and will return
|
||||
* <code>true</code> if the underlying comparator returns <code>0</code>. In addition to the default
|
||||
* <p>The input variable {@code TWO} in compared to the stored variable {@code ONE} using
|
||||
* the supplied {@code comparator}. This is the default usage of the predicate and will return
|
||||
* {@code true} if the underlying comparator returns {@code 0}. In addition to the default
|
||||
* usage of the predicate, it is possible to evaluate the comparator's result in several ways. The
|
||||
* following {@link Criterion} enumeration values are provided by the predicate:
|
||||
* </p>
|
||||
|
@ -70,9 +70,9 @@ import org.apache.commons.collections4.Predicate;
|
|||
* ComparatorPredicate.comparatorPredicate(ONE, comparator,<b>ComparatorPredicate.Criterion.GREATER</b>).evaluate(TWO);
|
||||
* </pre>
|
||||
*
|
||||
* <p>The input variable TWO is compared to the stored variable ONE using the supplied <code>comparator</code>
|
||||
* using the <code>GREATER</code> evaluation criterion constant. This instructs the predicate to
|
||||
* return <code>true</code> if the comparator returns a value greater than <code>0</code>.</p>
|
||||
* <p>The input variable TWO is compared to the stored variable ONE using the supplied {@code comparator}
|
||||
* using the {@code GREATER} evaluation criterion constant. This instructs the predicate to
|
||||
* return {@code true} if the comparator returns a value greater than {@code 0}.</p>
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
|
@ -126,7 +126,7 @@ public class ComparatorPredicate<T> implements Predicate<T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>comparatorPredicate</code> if you want that.
|
||||
* Use {@code comparatorPredicate} if you want that.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
* @param comparator the comparator to use for comparison
|
||||
|
@ -140,14 +140,14 @@ public class ComparatorPredicate<T> implements Predicate<T>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Evaluates the predicate. The predicate evaluates to <code>true</code> in the following cases:
|
||||
* Evaluates the predicate. The predicate evaluates to {@code true} in the following cases:
|
||||
*
|
||||
* <ul>
|
||||
* <li><code>comparator.compare(object, input) == 0 && criterion == EQUAL</code></li>
|
||||
* <li><code>comparator.compare(object, input) < 0 && criterion == LESS</code></li>
|
||||
* <li><code>comparator.compare(object, input) > 0 && criterion == GREATER</code></li>
|
||||
* <li><code>comparator.compare(object, input) >= 0 && criterion == GREATER_OR_EQUAL</code></li>
|
||||
* <li><code>comparator.compare(object, input) <= 0 && criterion == LESS_OR_EQUAL</code></li>
|
||||
* <li>{@code comparator.compare(object, input) == 0 && criterion == EQUAL}</li>
|
||||
* <li>{@code comparator.compare(object, input) < 0 && criterion == LESS}</li>
|
||||
* <li>{@code comparator.compare(object, input) > 0 && criterion == GREATER}</li>
|
||||
* <li>{@code comparator.compare(object, input) >= 0 && criterion == GREATER_OR_EQUAL}</li>
|
||||
* <li>{@code comparator.compare(object, input) <= 0 && criterion == LESS_OR_EQUAL}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see org.apache.commons.collections4.Predicate#evaluate(java.lang.Object)
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ConstantFactory<T> implements Factory<T>, Serializable {
|
|||
*
|
||||
* @param <T> the type of the constant
|
||||
* @param constantToReturn the constant object to return each time in the factory
|
||||
* @return the <code>constant</code> factory.
|
||||
* @return the {@code constant} factory.
|
||||
*/
|
||||
public static <T> Factory<T> constantFactory(final T constantToReturn) {
|
||||
if (constantToReturn == null) {
|
||||
|
@ -58,7 +58,7 @@ public class ConstantFactory<T> implements Factory<T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>constantFactory</code> if you want that.
|
||||
* Use {@code constantFactory} if you want that.
|
||||
*
|
||||
* @param constantToReturn the constant to return each time
|
||||
*/
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializabl
|
|||
* @param <I> the input type
|
||||
* @param <O> the output type
|
||||
* @param constantToReturn the constant object to return each time in the factory
|
||||
* @return the <code>constant</code> factory.
|
||||
* @return the {@code constant} factory.
|
||||
*/
|
||||
public static <I, O> Transformer<I, O> constantTransformer(final O constantToReturn) {
|
||||
if (constantToReturn == null) {
|
||||
|
@ -70,7 +70,7 @@ public class ConstantTransformer<I, O> implements Transformer<I, O>, Serializabl
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>constantTransformer</code> if you want that.
|
||||
* Use {@code constantTransformer} if you want that.
|
||||
*
|
||||
* @param constantToReturn the constant to return each time
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DefaultEquator<T> implements Equator<T>, Serializable {
|
|||
public static final DefaultEquator INSTANCE = new DefaultEquator<>();
|
||||
|
||||
/**
|
||||
* Hashcode used for <code>null</code> objects.
|
||||
* Hashcode used for {@code null} objects.
|
||||
*/
|
||||
public static final int HASHCODE_NULL = -1;
|
||||
|
||||
|
@ -68,8 +68,8 @@ public class DefaultEquator<T> implements Equator<T>, Serializable {
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return <code>o.hashCode()</code> if <code>o</code> is non-
|
||||
* <code>null</code>, else {@link #HASHCODE_NULL}.
|
||||
* @return {@code o.hashCode()} if {@code o} is non-
|
||||
* {@code null}, else {@link #HASHCODE_NULL}.
|
||||
*/
|
||||
@Override
|
||||
public int hash(final T o) {
|
||||
|
|
|
@ -70,7 +70,7 @@ public final class EqualPredicate<T> implements Predicate<T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>equalPredicate</code> if you want that.
|
||||
* Use {@code equalPredicate} if you want that.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ public final class EqualPredicate<T> implements Predicate<T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>equalPredicate</code> if you want that.
|
||||
* Use {@code equalPredicate} if you want that.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
* @param equator the equator to use for comparison
|
||||
|
|
|
@ -41,7 +41,7 @@ public class FactoryTransformer<I, O> implements Transformer<I, O>, Serializable
|
|||
* @param <I> the input type
|
||||
* @param <O> the output type
|
||||
* @param factory the factory to call, not null
|
||||
* @return the <code>factory</code> transformer
|
||||
* @return the {@code factory} transformer
|
||||
* @throws NullPointerException if the factory is null
|
||||
*/
|
||||
public static <I, O> Transformer<I, O> factoryTransformer(final Factory<? extends O> factory) {
|
||||
|
@ -50,7 +50,7 @@ public class FactoryTransformer<I, O> implements Transformer<I, O>, Serializable
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>factoryTransformer</code> if you want that.
|
||||
* Use {@code factoryTransformer} if you want that.
|
||||
*
|
||||
* @param factory the factory to call, not null
|
||||
*/
|
||||
|
|
|
@ -39,13 +39,13 @@ public class ForClosure<E> implements Closure<E> {
|
|||
/**
|
||||
* Factory method that performs validation.
|
||||
* <p>
|
||||
* A null closure or zero count returns the <code>NOPClosure</code>.
|
||||
* A null closure or zero count returns the {@code NOPClosure}.
|
||||
* A count of one returns the specified closure.
|
||||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param count the number of times to execute the closure
|
||||
* @param closure the closure to execute, not null
|
||||
* @return the <code>for</code> closure
|
||||
* @return the {@code for} closure
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E> Closure<E> forClosure(final int count, final Closure<? super E> closure) {
|
||||
|
@ -60,7 +60,7 @@ public class ForClosure<E> implements Closure<E> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>forClosure</code> if you want that.
|
||||
* Use {@code forClosure} if you want that.
|
||||
*
|
||||
* @param count the number of times to execute the closure
|
||||
* @param closure the closure to execute, not null
|
||||
|
@ -72,7 +72,7 @@ public class ForClosure<E> implements Closure<E> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Executes the closure <code>count</code> times.
|
||||
* Executes the closure {@code count} times.
|
||||
*
|
||||
* @param input the input object
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class IdentityPredicate<T> implements Predicate<T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>identityPredicate</code> if you want that.
|
||||
* Use {@code identityPredicate} if you want that.
|
||||
*
|
||||
* @param object the object to compare to
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public class IfClosure<E> implements Closure<E>, Serializable {
|
|||
* @param <E> the type that the closure acts on
|
||||
* @param predicate predicate to switch on
|
||||
* @param trueClosure closure used if true
|
||||
* @return the <code>if</code> closure
|
||||
* @return the {@code if} closure
|
||||
* @throws NullPointerException if either argument is null
|
||||
* @since 3.2
|
||||
*/
|
||||
|
@ -64,7 +64,7 @@ public class IfClosure<E> implements Closure<E>, Serializable {
|
|||
* @param predicate predicate to switch on
|
||||
* @param trueClosure closure used if true
|
||||
* @param falseClosure closure used if false
|
||||
* @return the <code>if</code> closure
|
||||
* @return the {@code if} closure
|
||||
* @throws NullPointerException if any argument is null
|
||||
*/
|
||||
public static <E> Closure<E> ifClosure(final Predicate<? super E> predicate,
|
||||
|
@ -77,7 +77,7 @@ public class IfClosure<E> implements Closure<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>ifClosure</code> if you want that.
|
||||
* Use {@code ifClosure} if you want that.
|
||||
* <p>
|
||||
* This constructor creates a closure that performs no action when
|
||||
* the predicate is false.
|
||||
|
@ -92,7 +92,7 @@ public class IfClosure<E> implements Closure<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>ifClosure</code> if you want that.
|
||||
* Use {@code ifClosure} if you want that.
|
||||
*
|
||||
* @param predicate predicate to switch on, not null
|
||||
* @param trueClosure closure used if true, not null
|
||||
|
|
|
@ -51,7 +51,7 @@ public class IfTransformer<I, O> implements Transformer<I, O>, Serializable {
|
|||
* @param predicate predicate to switch on
|
||||
* @param trueTransformer transformer used if true
|
||||
* @param falseTransformer transformer used if false
|
||||
* @return the <code>if</code> transformer
|
||||
* @return the {@code if} transformer
|
||||
* @throws NullPointerException if either argument is null
|
||||
*/
|
||||
public static <I, O> Transformer<I, O> ifTransformer(final Predicate<? super I> predicate,
|
||||
|
@ -71,7 +71,7 @@ public class IfTransformer<I, O> implements Transformer<I, O>, Serializable {
|
|||
* @param <T> input and output type for the transformer
|
||||
* @param predicate predicate to switch on
|
||||
* @param trueTransformer transformer used if true
|
||||
* @return the <code>if</code> transformer
|
||||
* @return the {@code if} transformer
|
||||
* @throws NullPointerException if either argument is null
|
||||
*/
|
||||
public static <T> Transformer<T, T> ifTransformer(
|
||||
|
@ -83,7 +83,7 @@ public class IfTransformer<I, O> implements Transformer<I, O>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use the static factory method <code>ifTransformer</code> if you want that.
|
||||
* Use the static factory method {@code ifTransformer} if you want that.
|
||||
*
|
||||
* @param predicate predicate to switch on, not null
|
||||
* @param trueTransformer transformer used if true, not null
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class InstanceofPredicate implements Predicate<Object>, Serializabl
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>instanceOfPredicate</code> if you want that.
|
||||
* Use {@code instanceOfPredicate} if you want that.
|
||||
*
|
||||
* @param type the type to check for
|
||||
*/
|
||||
|
|
|
@ -74,7 +74,7 @@ public class InstantiateFactory<T> implements Factory<T> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>instantiateFactory</code> if you want that.
|
||||
* Use {@code instantiateFactory} if you want that.
|
||||
*
|
||||
* @param classToInstantiate the class to instantiate
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ public class InstantiateFactory<T> implements Factory<T> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>instantiateFactory</code> if you want that.
|
||||
* Use {@code instantiateFactory} if you want that.
|
||||
*
|
||||
* @param classToInstantiate the class to instantiate
|
||||
* @param paramTypes the constructor parameter types, cloned
|
||||
|
|
|
@ -88,7 +88,7 @@ public class InstantiateTransformer<T> implements Transformer<Class<? extends T>
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>instantiateTransformer</code> if you want that.
|
||||
* Use {@code instantiateTransformer} if you want that.
|
||||
* <p>
|
||||
* Note: from 4.0, the input parameters will be cloned
|
||||
*
|
||||
|
|
|
@ -97,7 +97,7 @@ public class InvokerTransformer<I, O> implements Transformer<I, O> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>invokerTransformer</code> if you want that.
|
||||
* Use {@code invokerTransformer} if you want that.
|
||||
* <p>
|
||||
* Note: from 4.0, the input parameters will be cloned
|
||||
*
|
||||
|
|
|
@ -54,7 +54,7 @@ public final class MapTransformer<I, O> implements Transformer<I, O>, Serializab
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>mapTransformer</code> if you want that.
|
||||
* Use {@code mapTransformer} if you want that.
|
||||
*
|
||||
* @param map the map to use for lookup, not cloned
|
||||
*/
|
||||
|
@ -64,7 +64,7 @@ public final class MapTransformer<I, O> implements Transformer<I, O>, Serializab
|
|||
}
|
||||
|
||||
/**
|
||||
* Transforms the input to result by looking it up in a <code>Map</code>.
|
||||
* Transforms the input to result by looking it up in a {@code Map}.
|
||||
*
|
||||
* @param input the input object to transform
|
||||
* @return the transformed result
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class NonePredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>any</code> predicate
|
||||
* @return the {@code any} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ public final class NonePredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>one</code> predicate
|
||||
* @return the {@code one} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ public final class NonePredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>nonePredicate</code> if you want that.
|
||||
* Use {@code nonePredicate} if you want that.
|
||||
*
|
||||
* @param predicates the predicates to check, not cloned, not null
|
||||
*/
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class NotPredicate<T> implements PredicateDecorator<T>, Serializabl
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>notPredicate</code> if you want that.
|
||||
* Use {@code notPredicate} if you want that.
|
||||
*
|
||||
* @param predicate the predicate to call after the null check
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class NullIsExceptionPredicate<T> implements PredicateDecorator<T>,
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>nullIsExceptionPredicate</code> if you want that.
|
||||
* Use {@code nullIsExceptionPredicate} if you want that.
|
||||
*
|
||||
* @param predicate the predicate to call after the null check
|
||||
*/
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class NullIsFalsePredicate<T> implements PredicateDecorator<T>, Ser
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>nullIsFalsePredicate</code> if you want that.
|
||||
* Use {@code nullIsFalsePredicate} if you want that.
|
||||
*
|
||||
* @param predicate the predicate to call after the null check
|
||||
*/
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class NullIsTruePredicate<T> implements PredicateDecorator<T>, Seri
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>nullIsTruePredicate</code> if you want that.
|
||||
* Use {@code nullIsTruePredicate} if you want that.
|
||||
*
|
||||
* @param predicate the predicate to call after the null check
|
||||
*/
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class OnePredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>any</code> predicate
|
||||
* @return the {@code any} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -65,7 +65,7 @@ public final class OnePredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
*
|
||||
* @param <T> the type that the predicate queries
|
||||
* @param predicates the predicates to check, cloned, not null
|
||||
* @return the <code>one</code> predicate
|
||||
* @return the {@code one} predicate
|
||||
* @throws NullPointerException if the predicates array is null
|
||||
* @throws NullPointerException if any predicate in the array is null
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ public final class OnePredicate<T> extends AbstractQuantifierPredicate<T> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>onePredicate</code> if you want that.
|
||||
* Use {@code onePredicate} if you want that.
|
||||
*
|
||||
* @param predicates the predicates to check, not cloned, not null
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class OrPredicate<T> implements PredicateDecorator<T>, Serializable
|
|||
* @param <T> the type that the predicate queries
|
||||
* @param predicate1 the first predicate to check, not null
|
||||
* @param predicate2 the second predicate to check, not null
|
||||
* @return the <code>and</code> predicate
|
||||
* @return the {@code and} predicate
|
||||
* @throws NullPointerException if either predicate is null
|
||||
*/
|
||||
public static <T> Predicate<T> orPredicate(final Predicate<? super T> predicate1,
|
||||
|
@ -53,7 +53,7 @@ public final class OrPredicate<T> implements PredicateDecorator<T>, Serializable
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>orPredicate</code> if you want that.
|
||||
* Use {@code orPredicate} if you want that.
|
||||
*
|
||||
* @param predicate1 the first predicate to check, not null
|
||||
* @param predicate2 the second predicate to check, not null
|
||||
|
|
|
@ -40,7 +40,7 @@ public class PredicateTransformer<T> implements Transformer<T, Boolean>, Seriali
|
|||
*
|
||||
* @param <T> the input type
|
||||
* @param predicate the predicate to call, not null
|
||||
* @return the <code>predicate</code> transformer
|
||||
* @return the {@code predicate} transformer
|
||||
* @throws IllegalArgumentException if the predicate is null
|
||||
*/
|
||||
public static <T> Transformer<T, Boolean> predicateTransformer(final Predicate<? super T> predicate) {
|
||||
|
@ -52,7 +52,7 @@ public class PredicateTransformer<T> implements Transformer<T, Boolean>, Seriali
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>predicateTransformer</code> if you want that.
|
||||
* Use {@code predicateTransformer} if you want that.
|
||||
*
|
||||
* @param predicate the predicate to call, not null
|
||||
*/
|
||||
|
|
|
@ -58,7 +58,7 @@ public class PrototypeFactory {
|
|||
*
|
||||
* @param <T> the type the factory creates
|
||||
* @param prototype the object to clone each time in the factory
|
||||
* @return the <code>prototype</code> factory, or a {@link ConstantFactory#NULL_INSTANCE} if
|
||||
* @return the {@code prototype} factory, or a {@link ConstantFactory#NULL_INSTANCE} if
|
||||
* the {@code prototype} is {@code null}
|
||||
* @throws IllegalArgumentException if the prototype cannot be cloned
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.apache.commons.collections4.Transformer;
|
|||
|
||||
/**
|
||||
* Transformer implementation that returns the result of calling
|
||||
* <code>String.valueOf</code> on the input object.
|
||||
* {@code String.valueOf} on the input object.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ public final class StringValueTransformer<T> implements Transformer<T, String>,
|
|||
}
|
||||
|
||||
/**
|
||||
* Transforms the input to result by calling <code>String.valueOf</code>.
|
||||
* Transforms the input to result by calling {@code String.valueOf}.
|
||||
*
|
||||
* @param input the input object to transform
|
||||
* @return the transformed result
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
|
|||
* @param predicates array of predicates, cloned, no nulls
|
||||
* @param closures matching array of closures, cloned, no nulls
|
||||
* @param defaultClosure the closure to use if no match, null means nop
|
||||
* @return the <code>chained</code> closure
|
||||
* @return the {@code chained} closure
|
||||
* @throws NullPointerException if array is null
|
||||
* @throws NullPointerException if any element in the array is null
|
||||
* @throws IllegalArgumentException if the array lengths of predicates and closures do not match
|
||||
|
@ -81,7 +81,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
|
|||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param predicatesAndClosures a map of predicates to closures
|
||||
* @return the <code>switch</code> closure
|
||||
* @return the {@code switch} closure
|
||||
* @throws NullPointerException if the map is null
|
||||
* @throws NullPointerException if any closure in the map is null
|
||||
* @throws ClassCastException if the map elements are of the wrong type
|
||||
|
@ -125,7 +125,7 @@ public class SwitchClosure<E> implements Closure<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>switchClosure</code> if you want that.
|
||||
* Use {@code switchClosure} if you want that.
|
||||
*
|
||||
* @param predicates array of predicates, cloned, no nulls
|
||||
* @param closures matching array of closures, cloned, no nulls
|
||||
|
|
|
@ -49,7 +49,7 @@ public class SwitchTransformer<I, O> implements Transformer<I, O>, Serializable
|
|||
* @param predicates array of predicates, cloned, no nulls
|
||||
* @param transformers matching array of transformers, cloned, no nulls
|
||||
* @param defaultTransformer the transformer to use if no match, null means return null
|
||||
* @return the <code>chained</code> transformer
|
||||
* @return the {@code chained} transformer
|
||||
* @throws NullPointerException if either array is null
|
||||
* @throws NullPointerException if any element in the arrays is null
|
||||
* @throws IllegalArgumentException if the arrays have different sizes
|
||||
|
@ -84,7 +84,7 @@ public class SwitchTransformer<I, O> implements Transformer<I, O>, Serializable
|
|||
* @param <I> the input type
|
||||
* @param <O> the output type
|
||||
* @param map a map of predicates to transformers
|
||||
* @return the <code>switch</code> transformer
|
||||
* @return the {@code switch} transformer
|
||||
* @throws NullPointerException if the map is null
|
||||
* @throws NullPointerException if any transformer in the map is null
|
||||
* @throws ClassCastException if the map elements are of the wrong type
|
||||
|
@ -137,7 +137,7 @@ public class SwitchTransformer<I, O> implements Transformer<I, O>, Serializable
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>switchTransformer</code> if you want that.
|
||||
* Use {@code switchTransformer} if you want that.
|
||||
*
|
||||
* @param predicates array of predicates, cloned, no nulls
|
||||
* @param transformers matching array of transformers, cloned, no nulls
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.commons.collections4.Transformer;
|
|||
|
||||
/**
|
||||
* Predicate implementation that transforms the given object before invoking
|
||||
* another <code>Predicate</code>.
|
||||
* another {@code Predicate}.
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ public final class TransformedPredicate<T> implements PredicateDecorator<T>, Ser
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>transformedPredicate</code> if you want that.
|
||||
* Use {@code transformedPredicate} if you want that.
|
||||
*
|
||||
* @param transformer the transformer to use
|
||||
* @param predicate the predicate to decorate
|
||||
|
|
|
@ -38,11 +38,11 @@ public class TransformerClosure<E> implements Closure<E>, Serializable {
|
|||
/**
|
||||
* Factory method that performs validation.
|
||||
* <p>
|
||||
* A null transformer will return the <code>NOPClosure</code>.
|
||||
* A null transformer will return the {@code NOPClosure}.
|
||||
*
|
||||
* @param <E> the type that the closure acts on
|
||||
* @param transformer the transformer to call, null means nop
|
||||
* @return the <code>transformer</code> closure
|
||||
* @return the {@code transformer} closure
|
||||
*/
|
||||
public static <E> Closure<E> transformerClosure(final Transformer<? super E, ?> transformer) {
|
||||
if (transformer == null) {
|
||||
|
@ -53,7 +53,7 @@ public class TransformerClosure<E> implements Closure<E>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>transformerClosure</code> if you want that.
|
||||
* Use {@code transformerClosure} if you want that.
|
||||
*
|
||||
* @param transformer the transformer to call, not null
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class TransformerPredicate<T> implements Predicate<T>, Serializable
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>transformerPredicate</code> if you want that.
|
||||
* Use {@code transformerPredicate} if you want that.
|
||||
*
|
||||
* @param transformer the transformer to decorate
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class UniquePredicate<T> implements Predicate<T>, Serializable {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>uniquePredicate</code> if you want that.
|
||||
* Use {@code uniquePredicate} if you want that.
|
||||
*/
|
||||
public UniquePredicate() {
|
||||
super();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class WhileClosure<E> implements Closure<E> {
|
|||
* @param predicate the predicate used to evaluate when the loop terminates, not null
|
||||
* @param closure the closure the execute, not null
|
||||
* @param doLoop true to act as a do-while loop, always executing the closure once
|
||||
* @return the <code>while</code> closure
|
||||
* @return the {@code while} closure
|
||||
* @throws NullPointerException if the predicate or closure is null
|
||||
*/
|
||||
public static <E> Closure<E> whileClosure(final Predicate<? super E> predicate,
|
||||
|
@ -60,7 +60,7 @@ public class WhileClosure<E> implements Closure<E> {
|
|||
|
||||
/**
|
||||
* Constructor that performs no validation.
|
||||
* Use <code>whileClosure</code> if you want that.
|
||||
* Use {@code whileClosure} if you want that.
|
||||
*
|
||||
* @param predicate the predicate used to evaluate when the loop terminates, not null
|
||||
* @param closure the closure the execute, not null
|
||||
|
|
|
@ -53,8 +53,8 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
|
|||
* specified array.
|
||||
*
|
||||
* @param array the array to iterate over.
|
||||
* @throws IllegalArgumentException if <code>array</code> is not an array.
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if {@code array} is not an array.
|
||||
* @throws NullPointerException if {@code array} is {@code null}
|
||||
*/
|
||||
public ArrayIterator(final Object array) {
|
||||
this(array, 0);
|
||||
|
@ -66,8 +66,8 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
|
|||
*
|
||||
* @param array the array to iterate over.
|
||||
* @param startIndex the index to start iterating at.
|
||||
* @throws IllegalArgumentException if <code>array</code> is not an array.
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if {@code array} is not an array.
|
||||
* @throws NullPointerException if {@code array} is {@code null}
|
||||
* @throws IndexOutOfBoundsException if the index is invalid
|
||||
*/
|
||||
public ArrayIterator(final Object array, final int startIndex) {
|
||||
|
@ -81,8 +81,8 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
|
|||
* @param array the array to iterate over.
|
||||
* @param startIndex the index to start iterating at.
|
||||
* @param endIndex the index to finish iterating at.
|
||||
* @throws IllegalArgumentException if <code>array</code> is not an array.
|
||||
* @throws NullPointerException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if {@code array} is not an array.
|
||||
* @throws NullPointerException if {@code array} is {@code null}
|
||||
* @throws IndexOutOfBoundsException if either index is invalid
|
||||
*/
|
||||
public ArrayIterator(final Object array, final int startIndex, final int endIndex) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue