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 2013/04/30 21:44:17 UTC
svn commit: r1477795 - in
/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4:
ClosureUtils.java CollectionUtils.java IteratorUtils.java ListUtils.java
MapUtils.java
Author: tn
Date: Tue Apr 30 19:44:16 2013
New Revision: 1477795
URL: http://svn.apache.org/r1477795
Log:
Remove trailing spaces, formatting + javadoc.
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java?rev=1477795&r1=1477794&r2=1477795&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ClosureUtils.java Tue Apr 30 19:44:16 2013
@@ -62,7 +62,7 @@ public class ClosureUtils {
* This could be useful during testing as a placeholder.
*
* @see org.apache.commons.collections4.functors.ExceptionClosure
- *
+ *
* @param <E> the type that the closure acts on
* @return the closure
*/
@@ -89,7 +89,7 @@ public class ClosureUtils {
* The transformer's result will be ignored.
*
* @see org.apache.commons.collections4.functors.TransformerClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param transformer the transformer to run each time in the closure, null means nop
* @return the closure
@@ -104,7 +104,7 @@ public class ClosureUtils {
* A null closure or zero count returns the <code>NOPClosure</code>.
*
* @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
@@ -115,11 +115,11 @@ public class ClosureUtils {
}
/**
- * Creates a Closure that will call the closure repeatedly until the
+ * Creates a Closure that will call the closure repeatedly until the
* predicate returns false.
*
* @see org.apache.commons.collections4.functors.WhileClosure
- *
+ *
* @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
@@ -135,7 +135,7 @@ public class ClosureUtils {
* until the predicate returns false.
*
* @see org.apache.commons.collections4.functors.WhileClosure
- *
+ *
* @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
@@ -153,7 +153,7 @@ public class ClosureUtils {
*
* @see org.apache.commons.collections4.functors.InvokerTransformer
* @see org.apache.commons.collections4.functors.TransformerClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param methodName the name of the method
* @return the <code>invoker</code> closure
@@ -188,9 +188,9 @@ public class ClosureUtils {
/**
* Create a new Closure that calls two Closures, passing the result of
* the first into the second.
- *
+ *
* @see org.apache.commons.collections4.functors.ChainedClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param closure1 the first closure
* @param closure2 the second closure
@@ -202,11 +202,11 @@ public class ClosureUtils {
}
/**
- * Create a new Closure that calls each closure in turn, passing the
+ * Create a new Closure that calls each closure in turn, passing the
* result into the next closure.
- *
+ *
* @see org.apache.commons.collections4.functors.ChainedClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param closures an array of closures to chain
* @return the <code>chained</code> closure
@@ -218,12 +218,12 @@ public class ClosureUtils {
}
/**
- * Create a new Closure that calls each closure in turn, passing the
+ * Create a new Closure that calls each closure in turn, passing the
* result into the next closure. The ordering is that of the iterator()
* method on the collection.
- *
+ *
* @see org.apache.commons.collections4.functors.ChainedClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param closures a collection of closures to chain
* @return the <code>chained</code> closure
@@ -238,9 +238,9 @@ public class ClosureUtils {
/**
* Create a new Closure that calls another closure based on the
* result of the specified predicate.
- *
+ *
* @see org.apache.commons.collections4.functors.IfClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param predicate the validating predicate
* @param trueClosure the closure called if the predicate is true
@@ -255,11 +255,11 @@ public class ClosureUtils {
}
/**
- * Create a new Closure that calls one of two closures depending
+ * Create a new Closure that calls one of two closures depending
* on the specified predicate.
- *
+ *
* @see org.apache.commons.collections4.functors.IfClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param predicate the predicate to switch on
* @param trueClosure the closure called if the predicate is true
@@ -275,15 +275,15 @@ public class ClosureUtils {
}
/**
- * Create a new Closure that calls one of the closures depending
+ * Create a new Closure that calls one of the closures depending
* on the predicates.
* <p>
- * The closure at array location 0 is called if the predicate at array
+ * The closure at array location 0 is called if the predicate at array
* location 0 returned true. Each predicate is evaluated
* until one returns true.
- *
+ *
* @see org.apache.commons.collections4.functors.SwitchClosure
- *
+ *
* @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
@@ -298,16 +298,16 @@ public class ClosureUtils {
}
/**
- * Create a new Closure that calls one of the closures depending
+ * Create a new Closure that calls one of the closures depending
* on the predicates.
* <p>
* The closure at array location 0 is called if the predicate at array
* location 0 returned true. Each predicate is evaluated
* until one returns true. If no predicates evaluate to true, the default
* closure is called.
- *
+ *
* @see org.apache.commons.collections4.functors.SwitchClosure
- *
+ *
* @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
@@ -322,20 +322,20 @@ public class ClosureUtils {
final Closure<? super E> defaultClosure) {
return SwitchClosure.<E>switchClosure(predicates, closures, defaultClosure);
}
-
+
/**
- * Create a new Closure that calls one of the closures depending
- * on the predicates.
+ * Create a new Closure that calls one of the closures depending
+ * on the predicates.
* <p>
- * The Map consists of Predicate keys and Closure values. A closure
+ * The Map consists of Predicate keys and Closure values. A closure
* is called if its matching predicate returns true. Each predicate is evaluated
* until one returns true. If no predicates evaluate to true, the default
- * closure is called. The default closure is set in the map with a
- * null key. The ordering is that of the iterator() method on the entryset
+ * closure is called. The default closure is set in the map with a
+ * null key. The ordering is that of the iterator() method on the entryset
* collection of the map.
- *
+ *
* @see org.apache.commons.collections4.functors.SwitchClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param predicatesAndClosures a map of predicates to closures
* @return the <code>switch</code> closure
@@ -350,15 +350,15 @@ public class ClosureUtils {
/**
* Create a new Closure that uses the input object as a key to find the
- * closure to call.
+ * closure to call.
* <p>
- * The Map consists of object keys and Closure values. A closure
+ * The Map consists of object keys and Closure values. A closure
* is called if the input object equals the key. If there is no match, the
* default closure is called. The default closure is set in the map
* using a null key.
- *
+ *
* @see org.apache.commons.collections4.functors.SwitchClosure
- *
+ *
* @param <E> the type that the closure acts on
* @param objectsAndClosures a map of objects to closures
* @return the closure
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java?rev=1477795&r1=1477794&r2=1477795&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/CollectionUtils.java Tue Apr 30 19:44:16 2013
@@ -56,10 +56,10 @@ public class CollectionUtils {
* @param <O> the element type
*/
private static class CardinalityHelper<O> {
-
+
/** Contains the cardinality for each object in collection A. */
final Map<O, Integer> cardinalityA;
-
+
/** Contains the cardinality for each object in collection B. */
final Map<O, Integer> cardinalityB;
@@ -76,7 +76,7 @@ public class CollectionUtils {
/**
* Returns the maximum frequency of an object.
* @param obj the object
- * @return the maximum frequency of the object
+ * @return the maximum frequency of the object
*/
public final int max(final Object obj) {
return Math.max(freqA(obj), freqB(obj));
@@ -123,10 +123,10 @@ public class CollectionUtils {
* @param <O> the element type
*/
private static class SetOperationCardinalityHelper<O> extends CardinalityHelper<O> implements Iterable<O> {
-
+
/** Contains the unique elements of the two collections. */
private final Set<O> elements;
-
+
/** Output collection. */
private final List<O> newList;
@@ -200,7 +200,7 @@ public class CollectionUtils {
/**
* Returns an immutable empty collection if the argument is <code>null</code>,
* 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>
@@ -307,7 +307,7 @@ public class CollectionUtils {
* Returns a new {@link Collection} containing <i>a</i> minus a subset of
* <i>b</i>. Only the elements of <i>b</i> that satisfy the predicate
* condition, <i>p</i> are subtracted from <i>a</i>.
- *
+ *
* <p>The cardinality of each element <i>e</i> in the returned {@link Collection}
* that satisfies the predicate condition will be the cardinality of <i>e</i> in <i>a</i>
* minus the cardinality of <i>e</i> in <i>b</i>, or zero, whichever is greater.</p>
@@ -394,7 +394,7 @@ public class CollectionUtils {
return true;
}
}
-
+
/**
* Returns <code>true</code> iff at least one element is in both collections.
* <p>
@@ -558,7 +558,7 @@ public class CollectionUtils {
return new EquatorWrapper(equator, input);
}
};
-
+
return isEqualCollection(collect(a, transformer), collect(b, transformer));
}
@@ -567,23 +567,23 @@ public class CollectionUtils {
* {@link #equals(Object)} and {@link #hashCode()}.
* <p>
* This class can be used to store objects into a Map.
- *
+ *
* @param <O> the element type
* @since 4.0
*/
private static class EquatorWrapper<O> {
private final Equator<O> equator;
private final O object;
-
+
public EquatorWrapper(final Equator<O> equator, final O object) {
this.equator = equator;
this.object = object;
}
-
+
public O getObject() {
- return object;
+ return object;
}
-
+
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof EquatorWrapper)) {
@@ -597,9 +597,9 @@ public class CollectionUtils {
@Override
public int hashCode() {
return equator.hash(object);
- }
+ }
}
-
+
/**
* Returns the number of occurrences of <i>obj</i> in <i>coll</i>.
*
@@ -1518,7 +1518,7 @@ public class CollectionUtils {
* they will be removed in the output collection
* @return a new sorted List, containing the elements of Collection a and b
* @throws IllegalArgumentException if either collection is null
- * @since 4.0
+ * @since 4.0
*/
public static <O extends Comparable<? super O>> List<O> collate(final Collection<? extends O> a,
final Collection<? extends O> b,
@@ -1535,16 +1535,16 @@ public class CollectionUtils {
* @param <O> the element type
* @param a the first collection, must not be null
* @param b the second collection, must not be null
- * @param c the comparator to use for the merge.
+ * @param c the comparator to use for the merge.
* @return a new sorted List, containing the elements of Collection a and b
* @throws IllegalArgumentException if either collection or the comparator is null
- * @since 4.0
+ * @since 4.0
*/
public static <O> List<O> collate(final Collection<? extends O> a, final Collection<? extends O> b,
final Comparator<? super O> c) {
return collate(a, b, c, true);
}
-
+
/**
* Merges two sorted Collections, a and b, into a single, sorted List
* such that the ordering of the elements according to Comparator c is retained.
@@ -1554,16 +1554,16 @@ public class CollectionUtils {
* @param <O> the element type
* @param a the first collection, must not be null
* @param b the second collection, must not be null
- * @param c the comparator to use for the merge.
+ * @param c the comparator to use for the merge.
* @param includeDuplicates if {@code true} duplicate elements will be retained, otherwise
* they will be removed in the output collection
* @return a new sorted List, containing the elements of Collection a and b
* @throws IllegalArgumentException if either collection or the comparator is null
- * @since 4.0
+ * @since 4.0
*/
public static <O> List<O> collate(final Collection<? extends O> a, final Collection<? extends O> b,
final Comparator<? super O> c, final boolean includeDuplicates) {
-
+
if (a == null || b == null) {
throw new IllegalArgumentException("The collections must not be null");
}
@@ -1603,14 +1603,14 @@ public class CollectionUtils {
* <p>
* For larger collections it is advised to use a {@link PermutationIterator} to
* iterate over all permutations.
- *
+ *
* @see PermutationIterator
- *
+ *
* @param <E> the element type
* @param collection the collection to create permutations for, may not be null
* @return an unordered collection of all permutations of the input collection
* @throws NullPointerException if collection is null
- * @since 4.0
+ * @since 4.0
*/
public static <E> Collection<List<E>> permutations(final Collection<E> collection) {
final PermutationIterator<E> it = new PermutationIterator<E>(collection);
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java?rev=1477795&r1=1477794&r2=1477795&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/IteratorUtils.java Tue Apr 30 19:44:16 2013
@@ -867,7 +867,6 @@ public class IteratorUtils {
return new IteratorIterable<E>(iterator, false);
}
-
/**
* Gets an iterable that wraps an iterator. The returned iterable can be
* used for multiple iterations.
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java?rev=1477795&r1=1477794&r2=1477795&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/ListUtils.java Tue Apr 30 19:44:16 2013
@@ -539,11 +539,13 @@ public class ListUtils {
* @param <E> the element type
* @param a the first list
* @param b the second list
+ * @param equator the equator used to test object equality
* @return the longest common subsequence
* @throws IllegalArgumentException if either list or the equator is {@code null}
* @since 4.0
*/
- public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b, final Equator<? super E> equator) {
+ public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b,
+ final Equator<? super E> equator) {
if (a == null || b == null) {
throw new IllegalArgumentException("List must not be null");
}
Modified: commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java?rev=1477795&r1=1477794&r2=1477795&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java (original)
+++ commons/proper/collections/trunk/src/main/java/org/apache/commons/collections4/MapUtils.java Tue Apr 30 19:44:16 2013
@@ -1177,11 +1177,11 @@ public class MapUtils {
}
//-----------------------------------------------------------------------
-
+
/**
* Returns an immutable empty map if the argument is <code>null</code>,
* or the argument itself otherwise.
- *
+ *
* @param <K> the key type
* @param <V> the value type
* @param map the map, possibly <code>null</code>
@@ -1190,7 +1190,7 @@ public class MapUtils {
public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) {
return map == null ? Collections.<K,V>emptyMap() : map;
}
-
+
/**
* Null-safe check if the specified map is empty.
* <p>
@@ -1694,8 +1694,8 @@ public class MapUtils {
* @param valueTransformer the <code>Transformer</code> used to transform the collection value into a value
* @throws NullPointerException if the map, collection or transformers are null
*/
- public static <K, V, E> void populateMap(final Map<K, V> map, final Collection<? extends E> collection,
- final Transformer<E, K> keyTransformer,
+ public static <K, V, E> void populateMap(final Map<K, V> map, final Collection<? extends E> collection,
+ final Transformer<E, K> keyTransformer,
final Transformer<E, V> valueTransformer) {
final Iterator<? extends E> iter = collection.iterator();
while (iter.hasNext()) {
@@ -1719,7 +1719,7 @@ public class MapUtils {
final Transformer<V, K> keyTransformer) {
populateMap(map, collection, keyTransformer, TransformerUtils.<V>nopTransformer());
}
-
+
/**
* Populates a MultiMap using the supplied <code>Transformer</code>s to transform the collection
* values into keys and values.
@@ -1733,8 +1733,8 @@ public class MapUtils {
* @param valueTransformer the <code>Transformer</code> used to transform the collection value 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 Collection<? extends E> collection,
- final Transformer<E, K> keyTransformer,
+ public static <K, V, E> void populateMap(final MultiMap<K, V> map, final Collection<? extends E> collection,
+ final Transformer<E, K> keyTransformer,
final Transformer<E, V> valueTransformer) {
final Iterator<? extends E> iter = collection.iterator();
while (iter.hasNext()) {