You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/06/22 15:00:30 UTC
svn commit: r1686855 [2/5] - in /commons/proper/collections/trunk/src:
changes/ main/java/org/apache/commons/collections4/
main/java/org/apache/commons/collections4/bag/
main/java/org/apache/commons/collections4/bidimap/
main/java/org/apache/commons/co...
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SplitMapUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SplitMapUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SplitMapUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/SplitMapUtils.java Mon Jun 22 13:00:27 2015
@@ -20,11 +20,11 @@ import java.util.Collection;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.collections4.set.UnmodifiableSet;
import org.apache.commons.collections4.collection.UnmodifiableCollection;
import org.apache.commons.collections4.iterators.UnmodifiableMapIterator;
import org.apache.commons.collections4.map.EntrySetToMapIteratorAdapter;
import org.apache.commons.collections4.map.UnmodifiableEntrySet;
+import org.apache.commons.collections4.set.UnmodifiableSet;
/**
* Utilities for working with "split maps:" objects that implement {@link Put}
@@ -205,15 +205,17 @@ public class SplitMapUtils {
* @param <V> the value type
* @param get to wrap, must not be null
* @return {@link IterableMap}
+ * @throws NullPointerException if the argument is null
*/
@SuppressWarnings("unchecked")
public static <K, V> IterableMap<K, V> readableMap(final Get<K, V> get) {
if (get == null) {
- throw new IllegalArgumentException("Get must not be null");
+ throw new NullPointerException("Get must not be null");
}
if (get instanceof Map) {
- return get instanceof IterableMap ? ((IterableMap<K, V>) get) : MapUtils
- .iterableMap((Map<K, V>) get);
+ return get instanceof IterableMap ?
+ ((IterableMap<K, V>) get) :
+ MapUtils.iterableMap((Map<K, V>) get);
}
return new WrappedGet<K, V>(get);
}
@@ -229,11 +231,12 @@ public class SplitMapUtils {
* @param <V> the element type
* @param put to wrap, must not be null
* @return {@link Map}
+ * @throws NullPointerException if the argument is null
*/
@SuppressWarnings("unchecked")
public static <K, V> Map<K, V> writableMap(final Put<K, V> put) {
if (put == null) {
- throw new IllegalArgumentException("Put must not be null");
+ throw new NullPointerException("Put must not be null");
}
if (put instanceof Map) {
return (Map<K, V>) put;
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TransformerUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TransformerUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TransformerUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TransformerUtils.java Mon Jun 22 13:00:27 2015
@@ -144,7 +144,7 @@ public class TransformerUtils {
* @param <T> the input/output type
* @param closure the closure to run each time in the transformer, not null
* @return the transformer
- * @throws IllegalArgumentException if the closure is null
+ * @throws NullPointerException if the closure is null
* @see ClosureTransformer
*/
public static <T> Transformer<T, T> asTransformer(final Closure<? super T> closure) {
@@ -158,7 +158,7 @@ public class TransformerUtils {
* @param <T> the input type
* @param predicate the predicate to run each time in the transformer, not null
* @return the transformer
- * @throws IllegalArgumentException if the predicate is null
+ * @throws NullPointerException if the predicate is null
* @see PredicateTransformer
*/
public static <T> Transformer<T, Boolean> asTransformer(final Predicate<? super T> predicate) {
@@ -173,7 +173,7 @@ public class TransformerUtils {
* @param <O> the output type
* @param factory the factory to run each time in the transformer, not null
* @return the transformer
- * @throws IllegalArgumentException if the factory is null
+ * @throws NullPointerException if the factory is null
* @see FactoryTransformer
*/
public static <I, O> Transformer<I, O> asTransformer(final Factory<? extends O> factory) {
@@ -187,7 +187,7 @@ public class TransformerUtils {
* @param <T> the input/output type
* @param transformers an array of transformers to chain
* @return the transformer
- * @throws IllegalArgumentException if the transformers array or any of the transformers is null
+ * @throws NullPointerException if the transformers array or any of the transformers is null
* @see ChainedTransformer
*/
public static <T> Transformer<T, T> chainedTransformer(
@@ -203,7 +203,7 @@ public class TransformerUtils {
* @param <T> the input/output type
* @param transformers a collection of transformers to chain
* @return the transformer
- * @throws IllegalArgumentException if the transformers collection or any of the transformers is null
+ * @throws NullPointerException if the transformers collection or any of the transformers is null
* @see ChainedTransformer
*/
public static <T> Transformer<T, T> chainedTransformer(
@@ -219,7 +219,7 @@ public class TransformerUtils {
* @param predicate the predicate to switch on
* @param trueTransformer the transformer called if the predicate is true
* @return the transformer
- * @throws IllegalArgumentException if either the predicate or transformer is null
+ * @throws NullPointerException if either the predicate or transformer is null
* @see IfTransformer
* @since 4.1
*/
@@ -238,7 +238,7 @@ public class TransformerUtils {
* @param trueTransformer the transformer called if the predicate is true
* @param falseTransformer the transformer called if the predicate is false
* @return the transformer
- * @throws IllegalArgumentException if either the predicate or transformer is null
+ * @throws NullPointerException if either the predicate or transformer is null
* @see IfTransformer
* @since 4.1
*/
@@ -258,7 +258,7 @@ public class TransformerUtils {
* @param trueTransformer the transformer called if the predicate is true
* @param falseTransformer the transformer called if the predicate is false
* @return the transformer
- * @throws IllegalArgumentException if either the predicate or transformer is null
+ * @throws NullPointerException if either the predicate or transformer is null
* @see SwitchTransformer
* @deprecated as of 4.1, use {@link #ifTransformer(Predicate, Transformer, Transformer))
*/
@@ -282,9 +282,9 @@ public class TransformerUtils {
* @param predicates an array of predicates to check
* @param transformers an array of transformers to call
* @return the transformer
- * @throws IllegalArgumentException if the either array is null or empty
- * @throws IllegalArgumentException if any element in the arrays is null
- * @throws IllegalArgumentException if the arrays are different sizes
+ * @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
* @see SwitchTransformer
*/
public static <I, O> Transformer<I, O> switchTransformer(final Predicate<? super I>[] predicates,
@@ -305,9 +305,9 @@ public class TransformerUtils {
* @param transformers an array of transformers to call
* @param defaultTransformer the default to call if no predicate matches, null means return null
* @return the transformer
- * @throws IllegalArgumentException if the either array is null or empty
- * @throws IllegalArgumentException if any element in the arrays is null
- * @throws IllegalArgumentException if the arrays are different sizes
+ * @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
* @see SwitchTransformer
*/
public static <I, O> Transformer<I, O> switchTransformer(final Predicate<? super I>[] predicates,
@@ -332,8 +332,8 @@ public class TransformerUtils {
* @param <O> the output type
* @param predicatesAndTransformers a map of predicates to transformers
* @return the transformer
- * @throws IllegalArgumentException if the map is null or empty
- * @throws IllegalArgumentException if any transformer in the map is null
+ * @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
* @see SwitchTransformer
*/
@@ -355,8 +355,8 @@ public class TransformerUtils {
* @param <O> the output type
* @param objectsAndTransformers a map of objects to transformers
* @return the transformer
- * @throws IllegalArgumentException if the map is null or empty
- * @throws IllegalArgumentException if any transformer in the map is null
+ * @throws NullPointerException if the map is null
+ * @throws NullPointerException if any transformer in the map is null
* @see SwitchTransformer
*/
@SuppressWarnings("unchecked")
@@ -364,7 +364,7 @@ public class TransformerUtils {
final Map<I, Transformer<I, O>> objectsAndTransformers) {
if (objectsAndTransformers == null) {
- throw new IllegalArgumentException("The object and transformer map must not be null");
+ throw new NullPointerException("The object and transformer map must not be null");
}
final Transformer<? super I, ? extends O> def = objectsAndTransformers.remove(null);
final int size = objectsAndTransformers.size();
@@ -434,7 +434,7 @@ public class TransformerUtils {
* @param <O> the output type
* @param methodName the method name to call on the input object, may not be null
* @return the transformer
- * @throws IllegalArgumentException if the methodName is null.
+ * @throws NullPointerException if the methodName is null.
* @see InvokerTransformer
*/
public static <I, O> Transformer<I, O> invokerTransformer(final String methodName) {
@@ -452,7 +452,8 @@ public class TransformerUtils {
* @param paramTypes the parameter types
* @param args the arguments
* @return the transformer
- * @throws IllegalArgumentException if the method name is null or the paramTypes and args don't match
+ * @throws NullPointerException if the method name is null
+ * @throws IllegalArgumentException if the paramTypes and args don't match
* @see InvokerTransformer
*/
public static <I, O> Transformer<I, O> invokerTransformer(final String methodName, final Class<?>[] paramTypes,
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TrieUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TrieUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TrieUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/TrieUtils.java Mon Jun 22 13:00:27 2015
@@ -38,6 +38,7 @@ public class TrieUtils {
* @param <V> the value type
* @param trie the trie to make unmodifiable, must not be null
* @return an unmodifiable trie backed by the given trie
+ * @throws NullPointerException if trie is null
*
* @see java.util.Collections#unmodifiableMap(java.util.Map)
*/
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractBagDecorator.java Mon Jun 22 13:00:27 2015
@@ -47,7 +47,7 @@ public abstract class AbstractBagDecorat
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if list is null
+ * @throws NullPointerException if bag is null
*/
protected AbstractBagDecorator(final Bag<E> bag) {
super(bag);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/AbstractSortedBagDecorator.java Mon Jun 22 13:00:27 2015
@@ -46,7 +46,7 @@ public abstract class AbstractSortedBagD
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if list is null
+ * @throws NullPointerException if bag is null
*/
protected AbstractSortedBagDecorator(final SortedBag<E> bag) {
super(bag);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionBag.java Mon Jun 22 13:00:27 2015
@@ -49,7 +49,7 @@ public final class CollectionBag<E> exte
* @param <E> the type of the elements in the bag
* @param bag the bag to decorate, must not be null
* @return a Bag that complies to the Collection contract
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
public static <E> Bag<E> collectionBag(final Bag<E> bag) {
return new CollectionBag<E>(bag);
@@ -60,7 +60,7 @@ public final class CollectionBag<E> exte
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
public CollectionBag(final Bag<E> bag) {
super(bag);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/CollectionSortedBag.java Mon Jun 22 13:00:27 2015
@@ -41,7 +41,7 @@ public final class CollectionSortedBag<E
* @param <E> the type of the elements in the bag
* @param bag the sorted bag to decorate, must not be null
* @return a SortedBag that complies to the Collection contract
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
public static <E> SortedBag<E> collectionSortedBag(final SortedBag<E> bag) {
return new CollectionSortedBag<E>(bag);
@@ -52,7 +52,7 @@ public final class CollectionSortedBag<E
* Constructor that wraps (not copies).
*
* @param bag the sorted bag to decorate, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
public CollectionSortedBag(final SortedBag<E> bag) {
super(bag);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedBag.java Mon Jun 22 13:00:27 2015
@@ -55,7 +55,7 @@ public class PredicatedBag<E> extends Pr
* @param bag the bag to decorate, must not be null
* @param predicate the predicate to use for validation, must not be null
* @return a new predicated Bag
- * @throws IllegalArgumentException if bag or predicate is null
+ * @throws NullPointerException if bag or predicate is null
* @throws IllegalArgumentException if the bag contains invalid elements
* @since 4.0
*/
@@ -72,7 +72,7 @@ public class PredicatedBag<E> extends Pr
*
* @param bag the bag to decorate, must not be null
* @param predicate the predicate to use for validation, must not be null
- * @throws IllegalArgumentException if bag or predicate is null
+ * @throws NullPointerException if bag or predicate is null
* @throws IllegalArgumentException if the bag contains invalid elements
*/
protected PredicatedBag(final Bag<E> bag, final Predicate<? super E> predicate) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/PredicatedSortedBag.java Mon Jun 22 13:00:27 2015
@@ -54,7 +54,7 @@ public class PredicatedSortedBag<E> exte
* @param bag the bag to decorate, must not be null
* @param predicate the predicate to use for validation, must not be null
* @return a new predicated SortedBag
- * @throws IllegalArgumentException if bag or predicate is null
+ * @throws NullPointerException if bag or predicate is null
* @throws IllegalArgumentException if the bag contains invalid elements
* @since 4.0
*/
@@ -71,7 +71,7 @@ public class PredicatedSortedBag<E> exte
*
* @param bag the bag to decorate, must not be null
* @param predicate the predicate to use for validation, must not be null
- * @throws IllegalArgumentException if bag or predicate is null
+ * @throws NullPointerException if bag or predicate is null
* @throws IllegalArgumentException if the bag contains invalid elements
*/
protected PredicatedSortedBag(final SortedBag<E> bag, final Predicate<? super E> predicate) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedBag.java Mon Jun 22 13:00:27 2015
@@ -44,7 +44,7 @@ public class SynchronizedBag<E> extends
* @param <E> the type of the elements in the bag
* @param bag the bag to decorate, must not be null
* @return a new synchronized Bag
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
* @since 4.0
*/
public static <E> SynchronizedBag<E> synchronizedBag(final Bag<E> bag) {
@@ -56,7 +56,7 @@ public class SynchronizedBag<E> extends
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
protected SynchronizedBag(final Bag<E> bag) {
super(bag);
@@ -67,7 +67,7 @@ public class SynchronizedBag<E> extends
*
* @param bag the bag to decorate, must not be null
* @param lock the lock to use, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag or lock is null
*/
protected SynchronizedBag(final Bag<E> bag, final Object lock) {
super(bag, lock);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/SynchronizedSortedBag.java Mon Jun 22 13:00:27 2015
@@ -44,7 +44,7 @@ public class SynchronizedSortedBag<E> ex
* @param <E> the type of the elements in the bag
* @param bag the bag to decorate, must not be null
* @return a new synchronized SortedBag
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
* @since 4.0
*/
public static <E> SynchronizedSortedBag<E> synchronizedSortedBag(final SortedBag<E> bag) {
@@ -56,7 +56,7 @@ public class SynchronizedSortedBag<E> ex
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
protected SynchronizedSortedBag(final SortedBag<E> bag) {
super(bag);
@@ -67,7 +67,7 @@ public class SynchronizedSortedBag<E> ex
*
* @param bag the bag to decorate, must not be null
* @param lock the lock to use, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag or lock is null
*/
protected SynchronizedSortedBag(final Bag<E> bag, final Object lock) {
super(bag, lock);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedBag.java Mon Jun 22 13:00:27 2015
@@ -51,7 +51,7 @@ public class TransformedBag<E> extends T
* @param bag the bag to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed Bag
- * @throws IllegalArgumentException if bag or transformer is null
+ * @throws NullPointerException if bag or transformer is null
* @since 4.0
*/
public static <E> Bag<E> transformingBag(final Bag<E> bag, final Transformer<? super E, ? extends E> transformer) {
@@ -70,12 +70,12 @@ public class TransformedBag<E> extends T
* @param bag the bag to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed Bag
- * @throws IllegalArgumentException if bag or transformer is null
+ * @throws NullPointerException if bag or transformer is null
* @since 4.0
*/
public static <E> Bag<E> transformedBag(final Bag<E> bag, final Transformer<? super E, ? extends E> transformer) {
final TransformedBag<E> decorated = new TransformedBag<E>(bag, transformer);
- if (transformer != null && bag != null && bag.size() > 0) {
+ if (bag.size() > 0) {
@SuppressWarnings("unchecked") // Bag is of type E
final E[] values = (E[]) bag.toArray(); // NOPMD - false positive for generics
bag.clear();
@@ -95,7 +95,7 @@ public class TransformedBag<E> extends T
*
* @param bag the bag to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
- * @throws IllegalArgumentException if bag or transformer is null
+ * @throws NullPointerException if bag or transformer is null
*/
protected TransformedBag(final Bag<E> bag, final Transformer<? super E, ? extends E> transformer) {
super(bag, transformer);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/TransformedSortedBag.java Mon Jun 22 13:00:27 2015
@@ -49,7 +49,7 @@ public class TransformedSortedBag<E> ext
* @param bag the bag to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed SortedBag
- * @throws IllegalArgumentException if bag or transformer is null
+ * @throws NullPointerException if bag or transformer is null
* @since 4.0
*/
public static <E> TransformedSortedBag<E> transformingSortedBag(final SortedBag<E> bag,
@@ -69,14 +69,14 @@ public class TransformedSortedBag<E> ext
* @param bag the bag to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed SortedBag
- * @throws IllegalArgumentException if bag or transformer is null
+ * @throws NullPointerException if bag or transformer is null
* @since 4.0
*/
public static <E> TransformedSortedBag<E> transformedSortedBag(final SortedBag<E> bag,
final Transformer<? super E, ? extends E> transformer) {
final TransformedSortedBag<E> decorated = new TransformedSortedBag<E>(bag, transformer);
- if (transformer != null && bag != null && bag.size() > 0) {
+ if (bag.size() > 0) {
@SuppressWarnings("unchecked") // bag is type E
final E[] values = (E[]) bag.toArray(); // NOPMD - false positive for generics
bag.clear();
@@ -96,7 +96,7 @@ public class TransformedSortedBag<E> ext
*
* @param bag the bag to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
- * @throws IllegalArgumentException if bag or transformer is null
+ * @throws NullPointerException if bag or transformer is null
*/
protected TransformedSortedBag(final SortedBag<E> bag, final Transformer<? super E, ? extends E> transformer) {
super(bag, transformer);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableBag.java Mon Jun 22 13:00:27 2015
@@ -52,7 +52,7 @@ public final class UnmodifiableBag<E>
* @param <E> the type of the elements in the bag
* @param bag the bag to decorate, must not be null
* @return an unmodifiable Bag
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
* @since 4.0
*/
public static <E> Bag<E> unmodifiableBag(final Bag<? extends E> bag) {
@@ -69,7 +69,7 @@ public final class UnmodifiableBag<E>
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
@SuppressWarnings("unchecked") // safe to upcast
private UnmodifiableBag(final Bag<? extends E> bag) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bag/UnmodifiableSortedBag.java Mon Jun 22 13:00:27 2015
@@ -52,7 +52,7 @@ public final class UnmodifiableSortedBag
* @param <E> the type of the elements in the bag
* @param bag the bag to decorate, must not be null
* @return an unmodifiable SortedBag
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
* @since 4.0
*/
public static <E> SortedBag<E> unmodifiableSortedBag(final SortedBag<E> bag) {
@@ -67,7 +67,7 @@ public final class UnmodifiableSortedBag
* Constructor that wraps (not copies).
*
* @param bag the bag to decorate, must not be null
- * @throws IllegalArgumentException if bag is null
+ * @throws NullPointerException if bag is null
*/
private UnmodifiableSortedBag(final SortedBag<E> bag) {
super(bag);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractBidiMapDecorator.java Mon Jun 22 13:00:27 2015
@@ -44,7 +44,7 @@ public abstract class AbstractBidiMapDec
* Constructor that wraps (not copies).
*
* @param map the map to decorate, must not be null
- * @throws IllegalArgumentException if the collection is null
+ * @throws NullPointerException if the collection is null
*/
protected AbstractBidiMapDecorator(final BidiMap<K, V> map) {
super(map);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.java Mon Jun 22 13:00:27 2015
@@ -42,7 +42,7 @@ public abstract class AbstractOrderedBid
* Constructor that wraps (not copies).
*
* @param map the map to decorate, must not be null
- * @throws IllegalArgumentException if the collection is null
+ * @throws NullPointerException if the collection is null
*/
protected AbstractOrderedBidiMapDecorator(final OrderedBidiMap<K, V> map) {
super(map);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.java Mon Jun 22 13:00:27 2015
@@ -43,7 +43,7 @@ public abstract class AbstractSortedBidi
* Constructor that wraps (not copies).
*
* @param map the map to decorate, must not be null
- * @throws IllegalArgumentException if the collection is null
+ * @throws NullPointerException if the collection is null
*/
public AbstractSortedBidiMapDecorator(final SortedBidiMap<K, V> map) {
super(map);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableBidiMap.java Mon Jun 22 13:00:27 2015
@@ -49,7 +49,7 @@ public final class UnmodifiableBidiMap<K
* @param <V> the value type
* @param map the map to decorate, must not be null
* @return an unmodifiable BidiMap
- * @throws IllegalArgumentException if map is null
+ * @throws NullPointerException if map is null
* @since 4.0
*/
public static <K, V> BidiMap<K, V> unmodifiableBidiMap(final BidiMap<? extends K, ? extends V> map) {
@@ -66,7 +66,7 @@ public final class UnmodifiableBidiMap<K
* Constructor that wraps (not copies).
*
* @param map the map to decorate, must not be null
- * @throws IllegalArgumentException if map is null
+ * @throws NullPointerException if map is null
*/
@SuppressWarnings("unchecked") // safe to upcast
private UnmodifiableBidiMap(final BidiMap<? extends K, ? extends V> map) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.java Mon Jun 22 13:00:27 2015
@@ -49,7 +49,7 @@ public final class UnmodifiableOrderedBi
* @param <V> the value type
* @param map the map to decorate, must not be null
* @return an unmodifiable OrderedBidiMap
- * @throws IllegalArgumentException if map is null
+ * @throws NullPointerException if map is null
* @since 4.0
*/
public static <K, V> OrderedBidiMap<K, V> unmodifiableOrderedBidiMap(
@@ -67,7 +67,7 @@ public final class UnmodifiableOrderedBi
* Constructor that wraps (not copies).
*
* @param map the map to decorate, must not be null
- * @throws IllegalArgumentException if map is null
+ * @throws NullPointerException if map is null
*/
@SuppressWarnings("unchecked") // safe to upcast
private UnmodifiableOrderedBidiMap(final OrderedBidiMap<? extends K, ? extends V> map) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.java Mon Jun 22 13:00:27 2015
@@ -51,7 +51,7 @@ public final class UnmodifiableSortedBid
* @param <V> the value type
* @param map the map to decorate, must not be null
* @return an unmodifiable SortedBidiMap
- * @throws IllegalArgumentException if map is null
+ * @throws NullPointerException if map is null
* @since 4.0
*/
public static <K, V> SortedBidiMap<K, V> unmodifiableSortedBidiMap(final SortedBidiMap<K, ? extends V> map) {
@@ -68,7 +68,7 @@ public final class UnmodifiableSortedBid
* Constructor that wraps (not copies).
*
* @param map the map to decorate, must not be null
- * @throws IllegalArgumentException if map is null
+ * @throws NullPointerException if map is null
*/
@SuppressWarnings("unchecked") // safe to upcast
private UnmodifiableSortedBidiMap(final SortedBidiMap<K, ? extends V> map) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/AbstractCollectionDecorator.java Mon Jun 22 13:00:27 2015
@@ -73,11 +73,11 @@ public abstract class AbstractCollection
* Constructor that wraps (not copies).
*
* @param coll the collection to decorate, must not be null
- * @throws IllegalArgumentException if the collection is null
+ * @throws NullPointerException if the collection is null
*/
protected AbstractCollectionDecorator(final Collection<E> coll) {
if (coll == null) {
- throw new IllegalArgumentException("Collection must not be null");
+ throw new NullPointerException("Collection must not be null.");
}
this.collection = coll;
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/PredicatedCollection.java Mon Jun 22 13:00:27 2015
@@ -94,7 +94,7 @@ public class PredicatedCollection<E> ext
* @param coll the collection to decorate, must not be null
* @param predicate the predicate to use for validation, must not be null
* @return a new predicated collection
- * @throws IllegalArgumentException if collection or predicate is null
+ * @throws NullPointerException if collection or predicate is null
* @throws IllegalArgumentException if the collection contains invalid elements
* @since 4.0
*/
@@ -112,13 +112,13 @@ public class PredicatedCollection<E> ext
*
* @param coll the collection to decorate, must not be null
* @param predicate the predicate to use for validation, must not be null
- * @throws IllegalArgumentException if collection or predicate is null
+ * @throws NullPointerException if collection or predicate is null
* @throws IllegalArgumentException if the collection contains invalid elements
*/
protected PredicatedCollection(final Collection<E> coll, final Predicate<? super E> predicate) {
super(coll);
if (predicate == null) {
- throw new IllegalArgumentException("Predicate must not be null");
+ throw new NullPointerException("Predicate must not be null.");
}
this.predicate = predicate;
for (final E item : coll) {
@@ -216,11 +216,11 @@ public class PredicatedCollection<E> ext
* Constructs a PredicatedCollectionBuilder with the specified Predicate.
*
* @param predicate the predicate to use
- * @throws IllegalArgumentException if predicate is null
+ * @throws NullPointerException if predicate is null
*/
public Builder(final Predicate<? super E> predicate) {
if (predicate == null) {
- throw new IllegalArgumentException("Predicate must not be null");
+ throw new NullPointerException("Predicate must not be null");
}
this.predicate = predicate;
}
@@ -282,11 +282,12 @@ public class PredicatedCollection<E> ext
*
* @param list the List to decorate, must not be null
* @return the decorated list.
- * @throws IllegalArgumentException if list is null or contains invalid elements
+ * @throws NullPointerException if list is null
+ * @throws IllegalArgumentException if list contains invalid elements
*/
public List<E> createPredicatedList(final List<E> list) {
if (list == null) {
- throw new IllegalArgumentException("list must not be null");
+ throw new NullPointerException("List must not be null.");
}
final List<E> predicatedList = PredicatedList.predicatedList(list, predicate);
predicatedList.addAll(accepted);
@@ -314,11 +315,12 @@ public class PredicatedCollection<E> ext
*
* @param set the set to decorate, must not be null
* @return the decorated set.
- * @throws IllegalArgumentException if set is null or contains invalid elements
+ * @throws NullPointerException if set is null
+ * @throws IllegalArgumentException if set contains invalid elements
*/
public Set<E> createPredicatedSet(final Set<E> set) {
if (set == null) {
- throw new IllegalArgumentException("set must not be null");
+ throw new NullPointerException("Set must not be null.");
}
final PredicatedSet<E> predicatedSet = PredicatedSet.predicatedSet(set, predicate);
predicatedSet.addAll(accepted);
@@ -346,11 +348,12 @@ public class PredicatedCollection<E> ext
*
* @param bag the bag to decorate, must not be null
* @return the decorated bag.
- * @throws IllegalArgumentException if bag is null or contains invalid elements
+ * @throws NullPointerException if bag is null
+ * @throws IllegalArgumentException if bag contains invalid elements
*/
public Bag<E> createPredicatedBag(final Bag<E> bag) {
if (bag == null) {
- throw new IllegalArgumentException("bag must not be null");
+ throw new NullPointerException("Bag must not be null.");
}
final PredicatedBag<E> predicatedBag = PredicatedBag.predicatedBag(bag, predicate);
predicatedBag.addAll(accepted);
@@ -378,11 +381,12 @@ public class PredicatedCollection<E> ext
*
* @param queue the queue to decorate, must not be null
* @return the decorated queue.
- * @throws IllegalArgumentException if queue is null or contains invalid elements
+ * @throws NullPointerException if queue is null
+ * @throws IllegalArgumentException if queue contains invalid elements
*/
public Queue<E> createPredicatedQueue(final Queue<E> queue) {
if (queue == null) {
- throw new IllegalArgumentException("queue must not be null");
+ throw new NullPointerException("queue must not be null");
}
final PredicatedQueue<E> predicatedQueue = PredicatedQueue.predicatedQueue(queue, predicate);
predicatedQueue.addAll(accepted);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java Mon Jun 22 13:00:27 2015
@@ -54,7 +54,7 @@ public class SynchronizedCollection<E> i
* @param <T> the type of the elements in the collection
* @param coll the collection to decorate, must not be null
* @return a new synchronized collection
- * @throws IllegalArgumentException if collection is null
+ * @throws NullPointerException if collection is null
* @since 4.0
*/
public static <T> SynchronizedCollection<T> synchronizedCollection(final Collection<T> coll) {
@@ -66,11 +66,11 @@ public class SynchronizedCollection<E> i
* Constructor that wraps (not copies).
*
* @param collection the collection to decorate, must not be null
- * @throws IllegalArgumentException if the collection is null
+ * @throws NullPointerException if the collection is null
*/
protected SynchronizedCollection(final Collection<E> collection) {
if (collection == null) {
- throw new IllegalArgumentException("Collection must not be null");
+ throw new NullPointerException("Collection must not be null.");
}
this.collection = collection;
this.lock = this;
@@ -81,11 +81,14 @@ public class SynchronizedCollection<E> i
*
* @param collection the collection to decorate, must not be null
* @param lock the lock object to use, must not be null
- * @throws IllegalArgumentException if the collection is null
+ * @throws NullPointerException if the collection or lock is null
*/
protected SynchronizedCollection(final Collection<E> collection, final Object lock) {
if (collection == null) {
- throw new IllegalArgumentException("Collection must not be null");
+ throw new NullPointerException("Collection must not be null.");
+ }
+ if (lock == null) {
+ throw new NullPointerException("Lock must not be null.");
}
this.collection = collection;
this.lock = lock;
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/TransformedCollection.java Mon Jun 22 13:00:27 2015
@@ -55,7 +55,7 @@ public class TransformedCollection<E> ex
* @param coll the collection to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed collection
- * @throws IllegalArgumentException if collection or transformer is null
+ * @throws NullPointerException if collection or transformer is null
* @since 4.0
*/
public static <E> TransformedCollection<E> transformingCollection(final Collection<E> coll,
@@ -75,7 +75,7 @@ public class TransformedCollection<E> ex
* @param collection the collection to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
* @return a new transformed Collection
- * @throws IllegalArgumentException if collection or transformer is null
+ * @throws NullPointerException if collection or transformer is null
* @since 4.0
*/
public static <E> TransformedCollection<E> transformedCollection(final Collection<E> collection,
@@ -103,12 +103,12 @@ public class TransformedCollection<E> ex
*
* @param coll the collection to decorate, must not be null
* @param transformer the transformer to use for conversion, must not be null
- * @throws IllegalArgumentException if collection or transformer is null
+ * @throws NullPointerException if collection or transformer is null
*/
protected TransformedCollection(final Collection<E> coll, final Transformer<? super E, ? extends E> transformer) {
super(coll);
if (transformer == null) {
- throw new IllegalArgumentException("Transformer must not be null");
+ throw new NullPointerException("Transformer must not be null");
}
this.transformer = transformer;
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableBoundedCollection.java Mon Jun 22 13:00:27 2015
@@ -52,7 +52,7 @@ public final class UnmodifiableBoundedCo
* @param <E> the type of the elements in the collection
* @param coll the <code>BoundedCollection</code> to decorate, must not be null
* @return a new unmodifiable bounded collection
- * @throws IllegalArgumentException if {@code coll} is {@code null}
+ * @throws NullPointerException if {@code coll} is {@code null}
* @since 4.0
*/
public static <E> BoundedCollection<E> unmodifiableBoundedCollection(final BoundedCollection<? extends E> coll) {
@@ -73,13 +73,14 @@ public final class UnmodifiableBoundedCo
* @param <E> the type of the elements in the collection
* @param coll the <code>BoundedCollection</code> to decorate, must not be null
* @return a new unmodifiable bounded collection
- * @throws IllegalArgumentException if {@code coll} is {@code null}
+ * @throws NullPointerException if coll is null
+ * @throws IllegalArgumentException if coll is not a {@code BoundedCollection}
* @since 4.0
*/
@SuppressWarnings("unchecked")
public static <E> BoundedCollection<E> unmodifiableBoundedCollection(Collection<? extends E> coll) {
if (coll == null) {
- throw new IllegalArgumentException("The collection must not be null");
+ throw new NullPointerException("Collection must not be null.");
}
// handle decorators
@@ -95,7 +96,7 @@ public final class UnmodifiableBoundedCo
}
if (coll instanceof BoundedCollection == false) {
- throw new IllegalArgumentException("The collection is not a bounded collection");
+ throw new IllegalArgumentException("Collection is not a bounded collection.");
}
return new UnmodifiableBoundedCollection<E>((BoundedCollection<E>) coll);
}
@@ -104,7 +105,7 @@ public final class UnmodifiableBoundedCo
* Constructor that wraps (not copies).
*
* @param coll the collection to decorate, must not be null
- * @throws IllegalArgumentException if coll is null
+ * @throws NullPointerException if coll is null
*/
@SuppressWarnings("unchecked") // safe to upcast
private UnmodifiableBoundedCollection(final BoundedCollection<? extends E> coll) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/collection/UnmodifiableCollection.java Mon Jun 22 13:00:27 2015
@@ -48,7 +48,7 @@ public final class UnmodifiableCollectio
* @param <T> the type of the elements in the collection
* @param coll the collection to decorate, must not be null
* @return an unmodifiable collection
- * @throws IllegalArgumentException if collection is null
+ * @throws NullPointerException if collection is null
* @since 4.0
*/
public static <T> Collection<T> unmodifiableCollection(final Collection<? extends T> coll) {
@@ -65,7 +65,7 @@ public final class UnmodifiableCollectio
* Constructor that wraps (not copies).
*
* @param coll the collection to decorate, must not be null
- * @throws IllegalArgumentException if collection is null
+ * @throws NullPointerException if collection is null
*/
@SuppressWarnings("unchecked") // safe to upcast
private UnmodifiableCollection(final Collection<? extends E> coll) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/comparators/FixedOrderComparator.java Mon Jun 22 13:00:27 2015
@@ -87,12 +87,12 @@ public class FixedOrderComparator<T> imp
* The array is copied, so later changes will not affect the comparator.
*
* @param items the items that the comparator can compare in order
- * @throws IllegalArgumentException if the array is null
+ * @throws NullPointerException if the array is null
*/
public FixedOrderComparator(final T... items) {
super();
if (items == null) {
- throw new IllegalArgumentException("The list of items must not be null");
+ throw new NullPointerException("The list of items must not be null");
}
for (final T item : items) {
add(item);
@@ -106,12 +106,12 @@ public class FixedOrderComparator<T> imp
* The list is copied, so later changes will not affect the comparator.
*
* @param items the items that the comparator can compare in order
- * @throws IllegalArgumentException if the list is null
+ * @throws NullPointerException if the list is null
*/
public FixedOrderComparator(final List<T> items) {
super();
if (items == null) {
- throw new IllegalArgumentException("The list of items must not be null");
+ throw new NullPointerException("The list of items must not be null");
}
for (final T t : items) {
add(t);
@@ -157,12 +157,12 @@ public class FixedOrderComparator<T> imp
* @param unknownObjectBehavior the flag for unknown behaviour -
* UNKNOWN_AFTER, UNKNOWN_BEFORE or UNKNOWN_THROW_EXCEPTION
* @throws UnsupportedOperationException if a comparison has been performed
- * @throws IllegalArgumentException if the unknown flag is not valid
+ * @throws NullPointerException if unknownObjectBehavior is null
*/
public void setUnknownObjectBehavior(final UnknownObjectBehavior unknownObjectBehavior) {
checkLocked();
if (unknownObjectBehavior == null) {
- throw new IllegalArgumentException("Unknown object behavior must not be null");
+ throw new NullPointerException("Unknown object behavior must not be null");
}
this.unknownObjectBehavior = unknownObjectBehavior;
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AllPredicate.java Mon Jun 22 13:00:27 2015
@@ -49,8 +49,8 @@ public final class AllPredicate<T> exten
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>all</code> predicate
- * @throws IllegalArgumentException if the predicates array is null
- * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws NullPointerException if the predicates array is null
+ * @throws NullPointerException if any predicate in the array is null
*/
public static <T> Predicate<T> allPredicate(final Predicate<? super T>... predicates) {
FunctorUtils.validate(predicates);
@@ -73,8 +73,8 @@ public final class AllPredicate<T> exten
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>all</code> predicate
- * @throws IllegalArgumentException if the predicates array is null
- * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws NullPointerException if the predicates array is null
+ * @throws NullPointerException if any predicate in the array is null
*/
public static <T> Predicate<T> allPredicate(final Collection<? extends Predicate<? super T>> predicates) {
final Predicate<? super T>[] preds = validate(predicates);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AndPredicate.java Mon Jun 22 13:00:27 2015
@@ -43,12 +43,12 @@ public final class AndPredicate<T> imple
* @param predicate1 the first predicate to check, not null
* @param predicate2 the second predicate to check, not null
* @return the <code>and</code> predicate
- * @throws IllegalArgumentException if either predicate is null
+ * @throws NullPointerException if either predicate is null
*/
public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1,
final Predicate<? super T> predicate2) {
if (predicate1 == null || predicate2 == null) {
- throw new IllegalArgumentException("Predicate must not be null");
+ throw new NullPointerException("Predicate must not be null");
}
return new AndPredicate<T>(predicate1, predicate2);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/AnyPredicate.java Mon Jun 22 13:00:27 2015
@@ -45,8 +45,8 @@ public final class AnyPredicate<T> exten
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>any</code> predicate
- * @throws IllegalArgumentException if the predicates array is null
- * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws NullPointerException if the predicates array is null
+ * @throws NullPointerException if any predicate in the array is null
*/
@SuppressWarnings("unchecked")
public static <T> Predicate<T> anyPredicate(final Predicate<? super T>... predicates) {
@@ -69,8 +69,8 @@ public final class AnyPredicate<T> exten
* @param <T> the type that the predicate queries
* @param predicates the predicates to check, cloned, not null
* @return the <code>all</code> predicate
- * @throws IllegalArgumentException if the predicates array is null
- * @throws IllegalArgumentException if any predicate in the array is null
+ * @throws NullPointerException if the predicates array is null
+ * @throws NullPointerException if any predicate in the array is null
*/
@SuppressWarnings("unchecked")
public static <T> Predicate<T> anyPredicate(final Collection<? extends Predicate<? super T>> predicates) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedClosure.java Mon Jun 22 13:00:27 2015
@@ -41,8 +41,8 @@ public class ChainedClosure<E> implement
* @param <E> the type that the closure acts on
* @param closures the closures to chain, copied, no nulls
* @return the <code>chained</code> closure
- * @throws IllegalArgumentException if the closures array is null
- * @throws IllegalArgumentException if any closure in the array is null
+ * @throws NullPointerException if the closures array is null
+ * @throws NullPointerException if any closure in the array is null
*/
public static <E> Closure<E> chainedClosure(final Closure<? super E>... closures) {
FunctorUtils.validate(closures);
@@ -60,13 +60,13 @@ public class ChainedClosure<E> implement
* @param <E> the type that the closure acts on
* @param closures a collection of closures to chain
* @return the <code>chained</code> closure
- * @throws IllegalArgumentException if the closures collection is null
- * @throws IllegalArgumentException if any closure in the collection is null
+ * @throws NullPointerException if the closures collection is null
+ * @throws NullPointerException if any closure in the collection is null
*/
@SuppressWarnings("unchecked")
public static <E> Closure<E> chainedClosure(final Collection<? extends Closure<? super E>> closures) {
if (closures == null) {
- throw new IllegalArgumentException("Closure collection must not be null");
+ throw new NullPointerException("Closure collection must not be null");
}
if (closures.size() == 0) {
return NOPClosure.<E>nopClosure();
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ChainedTransformer.java Mon Jun 22 13:00:27 2015
@@ -44,8 +44,8 @@ public class ChainedTransformer<T> imple
* @param <T> the object type
* @param transformers the transformers to chain, copied, no nulls
* @return the <code>chained</code> transformer
- * @throws IllegalArgumentException if the transformers array is null
- * @throws IllegalArgumentException if any transformer in the array is null
+ * @throws NullPointerException if the transformers array is null
+ * @throws NullPointerException if any transformer in the array is null
*/
public static <T> Transformer<T, T> chainedTransformer(final Transformer<? super T, ? extends T>... transformers) {
FunctorUtils.validate(transformers);
@@ -63,14 +63,14 @@ public class ChainedTransformer<T> imple
* @param <T> the object type
* @param transformers a collection of transformers to chain
* @return the <code>chained</code> transformer
- * @throws IllegalArgumentException if the transformers collection is null
- * @throws IllegalArgumentException if any transformer in the collection is null
+ * @throws NullPointerException if the transformers collection is null
+ * @throws NullPointerException if any transformer in the collection is null
*/
@SuppressWarnings("unchecked")
public static <T> Transformer<T, T> chainedTransformer(
final Collection<? extends Transformer<? super T, ? extends T>> transformers) {
if (transformers == null) {
- throw new IllegalArgumentException("Transformer collection must not be null");
+ throw new NullPointerException("Transformer collection must not be null");
}
if (transformers.size() == 0) {
return NOPTransformer.<T>nopTransformer();
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ClosureTransformer.java Mon Jun 22 13:00:27 2015
@@ -42,11 +42,11 @@ public class ClosureTransformer<T> imple
* @param <T> the type of the object to transform
* @param closure the closure to call, not null
* @return the <code>closure</code> transformer
- * @throws IllegalArgumentException if the closure is null
+ * @throws NullPointerException if the closure is null
*/
public static <T> Transformer<T, T> closureTransformer(final Closure<? super T> closure) {
if (closure == null) {
- throw new IllegalArgumentException("Closure must not be null");
+ throw new NullPointerException("Closure must not be null");
}
return new ClosureTransformer<T>(closure);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/ComparatorPredicate.java Mon Jun 22 13:00:27 2015
@@ -102,7 +102,7 @@ public class ComparatorPredicate<T> impl
* @param object the object to compare to
* @param comparator the comparator to use for comparison
* @return the predicate
- * @throws IllegalArgumentException if comparator is null
+ * @throws NullPointerException if comparator is null
*/
public static <T> Predicate<T> comparatorPredicate(final T object, final Comparator<T> comparator) {
return comparatorPredicate(object, comparator, Criterion.EQUAL);
@@ -116,15 +116,15 @@ public class ComparatorPredicate<T> impl
* @param comparator the comparator to use for comparison
* @param criterion the criterion to use to evaluate comparison
* @return the predicate
- * @throws IllegalArgumentException if comparator is null of criterion is invalid
+ * @throws NullPointerException if comparator or criterion is null
*/
public static <T> Predicate<T> comparatorPredicate(final T object, final Comparator<T> comparator,
final Criterion criterion) {
if (comparator == null) {
- throw new IllegalArgumentException("Comparator must not be null.");
+ throw new NullPointerException("Comparator must not be null.");
}
if (criterion == null) {
- throw new IllegalArgumentException("Criterion must not be null.");
+ throw new NullPointerException("Criterion must not be null.");
}
return new ComparatorPredicate<T>(object, comparator, criterion);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FactoryTransformer.java Mon Jun 22 13:00:27 2015
@@ -42,11 +42,11 @@ public class FactoryTransformer<I, O> im
* @param <O> the output type
* @param factory the factory to call, not null
* @return the <code>factory</code> transformer
- * @throws IllegalArgumentException if the factory is null
+ * @throws NullPointerException if the factory is null
*/
public static <I, O> Transformer<I, O> factoryTransformer(final Factory<? extends O> factory) {
if (factory == null) {
- throw new IllegalArgumentException("Factory must not be null");
+ throw new NullPointerException("Factory must not be null");
}
return new FactoryTransformer<I, O>(factory);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/FunctorUtils.java Mon Jun 22 13:00:27 2015
@@ -77,11 +77,11 @@ class FunctorUtils {
*/
static void validate(final Predicate<?>... predicates) {
if (predicates == null) {
- throw new IllegalArgumentException("The predicate array must not be null");
+ throw new NullPointerException("The predicate array must not be null");
}
for (int i = 0; i < predicates.length; i++) {
if (predicates[i] == null) {
- throw new IllegalArgumentException(
+ throw new NullPointerException(
"The predicate array must not contain a null predicate, index " + i + " was null");
}
}
@@ -95,7 +95,7 @@ class FunctorUtils {
*/
static <T> Predicate<? super T>[] validate(final Collection<? extends Predicate<? super T>> predicates) {
if (predicates == null) {
- throw new IllegalArgumentException("The predicate collection must not be null");
+ throw new NullPointerException("The predicate collection must not be null");
}
// convert to array like this to guarantee iterator() ordering
@SuppressWarnings("unchecked") // OK
@@ -104,7 +104,7 @@ class FunctorUtils {
for (final Predicate<? super T> predicate : predicates) {
preds[i] = predicate;
if (preds[i] == null) {
- throw new IllegalArgumentException(
+ throw new NullPointerException(
"The predicate collection must not contain a null predicate, index " + i + " was null");
}
i++;
@@ -133,11 +133,11 @@ class FunctorUtils {
*/
static void validate(final Closure<?>... closures) {
if (closures == null) {
- throw new IllegalArgumentException("The closure array must not be null");
+ throw new NullPointerException("The closure array must not be null");
}
for (int i = 0; i < closures.length; i++) {
if (closures[i] == null) {
- throw new IllegalArgumentException(
+ throw new NullPointerException(
"The closure array must not contain a null closure, index " + i + " was null");
}
}
@@ -179,11 +179,11 @@ class FunctorUtils {
*/
static void validate(final Transformer<?, ?>... transformers) {
if (transformers == null) {
- throw new IllegalArgumentException("The transformer array must not be null");
+ throw new NullPointerException("The transformer array must not be null");
}
for (int i = 0; i < transformers.length; i++) {
if (transformers[i] == null) {
- throw new IllegalArgumentException(
+ throw new NullPointerException(
"The transformer array must not contain a null transformer, index " + i + " was null");
}
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IdentityPredicate.java Mon Jun 22 13:00:27 2015
@@ -41,7 +41,6 @@ public final class IdentityPredicate<T>
* @param <T> the type that the predicate queries
* @param object the object to compare to
* @return the predicate
- * @throws IllegalArgumentException if the predicate is null
*/
public static <T> Predicate<T> identityPredicate(final T object) {
if (object == null) {
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfClosure.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfClosure.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfClosure.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfClosure.java Mon Jun 22 13:00:27 2015
@@ -50,7 +50,7 @@ public class IfClosure<E> implements Clo
* @param predicate predicate to switch on
* @param trueClosure closure used if true
* @return the <code>if</code> closure
- * @throws IllegalArgumentException if either argument is null
+ * @throws NullPointerException if either argument is null
* @since 3.2
*/
public static <E> Closure<E> ifClosure(final Predicate<? super E> predicate, final Closure<? super E> trueClosure) {
@@ -65,16 +65,16 @@ public class IfClosure<E> implements Clo
* @param trueClosure closure used if true
* @param falseClosure closure used if false
* @return the <code>if</code> closure
- * @throws IllegalArgumentException if any argument is null
+ * @throws NullPointerException if any argument is null
*/
public static <E> Closure<E> ifClosure(final Predicate<? super E> predicate,
final Closure<? super E> trueClosure,
final Closure<? super E> falseClosure) {
if (predicate == null) {
- throw new IllegalArgumentException("Predicate must not be null");
+ throw new NullPointerException("Predicate must not be null");
}
if (trueClosure == null || falseClosure == null) {
- throw new IllegalArgumentException("Closures must not be null");
+ throw new NullPointerException("Closures must not be null");
}
return new IfClosure<E>(predicate, trueClosure, falseClosure);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/IfTransformer.java Mon Jun 22 13:00:27 2015
@@ -16,11 +16,11 @@
*/
package org.apache.commons.collections4.functors;
+import java.io.Serializable;
+
import org.apache.commons.collections4.Predicate;
import org.apache.commons.collections4.Transformer;
-import java.io.Serializable;
-
/**
* Transformer implementation that will call one of two closures based on whether a predicate evaluates
* as true or false.
@@ -52,15 +52,16 @@ public class IfTransformer<I, O> impleme
* @param trueTransformer transformer used if true
* @param falseTransformer transformer used if false
* @return the <code>if</code> transformer
+ * @throws NullPointerException if either argument is null
*/
public static <I, O> Transformer<I, O> ifTransformer(final Predicate<? super I> predicate,
final Transformer<? super I, ? extends O> trueTransformer,
final Transformer<? super I, ? extends O> falseTransformer) {
if (predicate == null) {
- throw new IllegalArgumentException("Predicate must not be null");
+ throw new NullPointerException("Predicate must not be null");
}
if (trueTransformer == null || falseTransformer == null) {
- throw new IllegalArgumentException("Transformers must not be null");
+ throw new NullPointerException("Transformers must not be null");
}
return new IfTransformer<I, O>(predicate, trueTransformer, falseTransformer);
@@ -76,16 +77,17 @@ public class IfTransformer<I, O> impleme
* @param predicate predicate to switch on
* @param trueTransformer transformer used if true
* @return the <code>if</code> transformer
+ * @throws NullPointerException if either argument is null
*/
public static <T> Transformer<T, T> ifTransformer(
final Predicate<? super T> predicate,
final Transformer<? super T, ? extends T> trueTransformer) {
if (predicate == null) {
- throw new IllegalArgumentException("Predicate must not be null");
+ throw new NullPointerException("Predicate must not be null");
}
if (trueTransformer == null) {
- throw new IllegalArgumentException("Transformer must not be null");
+ throw new NullPointerException("Transformer must not be null");
}
return new IfTransformer<T, T>(predicate, trueTransformer, NOPTransformer.<T>nopTransformer());
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstanceofPredicate.java Mon Jun 22 13:00:27 2015
@@ -40,11 +40,11 @@ public final class InstanceofPredicate i
*
* @param type the type to check for, may not be null
* @return the predicate
- * @throws IllegalArgumentException if the class is null
+ * @throws NullPointerException if the class is null
*/
public static Predicate<Object> instanceOfPredicate(final Class<?> type) {
if (type == null) {
- throw new IllegalArgumentException("The type to check instanceof must not be null");
+ throw new NullPointerException("The type to check instanceof must not be null");
}
return new InstanceofPredicate(type);
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateFactory.java Mon Jun 22 13:00:27 2015
@@ -51,12 +51,14 @@ public class InstantiateFactory<T> imple
* @param paramTypes the constructor parameter types, cloned
* @param args the constructor arguments, cloned
* @return a new instantiate factory
+ * @throws NullPointerException if classToInstantiate is null
+ * @throws IllegalArgumentException if paramTypes does not match args
*/
public static <T> Factory<T> instantiateFactory(final Class<T> classToInstantiate,
final Class<?>[] paramTypes,
final Object[] args) {
if (classToInstantiate == null) {
- throw new IllegalArgumentException("Class to instantiate must not be null");
+ throw new NullPointerException("Class to instantiate must not be null");
}
if (paramTypes == null && args != null
|| paramTypes != null && args == null
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java?rev=1686855&r1=1686854&r2=1686855&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java Mon Jun 22 13:00:27 2015
@@ -61,6 +61,7 @@ public class InstantiateTransformer<T> i
* @param paramTypes the constructor parameter types
* @param args the constructor arguments
* @return an instantiate transformer
+ * @throws IllegalArgumentException if paramTypes does not match args
*/
public static <T> Transformer<Class<? extends T>, T> instantiateTransformer(final Class<?>[] paramTypes,
final Object[] args) {