From 88564caa20e4bee55287b258543cab35e9d3adf6 Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Tue, 30 Apr 2013 19:44:16 +0000 Subject: [PATCH] Remove trailing spaces, formatting + javadoc. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1477795 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections4/ClosureUtils.java | 78 +++++++++---------- .../commons/collections4/CollectionUtils.java | 52 ++++++------- .../commons/collections4/IteratorUtils.java | 1 - .../commons/collections4/ListUtils.java | 4 +- .../apache/commons/collections4/MapUtils.java | 16 ++-- 5 files changed, 76 insertions(+), 75 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/ClosureUtils.java b/src/main/java/org/apache/commons/collections4/ClosureUtils.java index 0528b7bf2..76699a583 100644 --- a/src/main/java/org/apache/commons/collections4/ClosureUtils.java +++ b/src/main/java/org/apache/commons/collections4/ClosureUtils.java @@ -62,7 +62,7 @@ public class ClosureUtils { * This could be useful during testing as a placeholder. * * @see org.apache.commons.collections4.functors.ExceptionClosure - * + * * @param 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 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 NOPClosure. * * @see org.apache.commons.collections4.functors.ForClosure - * + * * @param 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 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 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 the type that the closure acts on * @param methodName the name of the method * @return the invoker 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 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 the type that the closure acts on * @param closures an array of closures to chain * @return the chained 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 the type that the closure acts on * @param closures a collection of closures to chain * @return the chained 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 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 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. *

- * 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 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. *

* 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 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 defaultClosure) { return SwitchClosure.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. *

- * 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 the type that the closure acts on * @param predicatesAndClosures a map of predicates to closures * @return the switch 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. *

- * 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 the type that the closure acts on * @param objectsAndClosures a map of objects to closures * @return the closure diff --git a/src/main/java/org/apache/commons/collections4/CollectionUtils.java b/src/main/java/org/apache/commons/collections4/CollectionUtils.java index c7520b633..7b4599bac 100644 --- a/src/main/java/org/apache/commons/collections4/CollectionUtils.java +++ b/src/main/java/org/apache/commons/collections4/CollectionUtils.java @@ -56,10 +56,10 @@ public class CollectionUtils { * @param the element type */ private static class CardinalityHelper { - + /** Contains the cardinality for each object in collection A. */ final Map cardinalityA; - + /** Contains the cardinality for each object in collection B. */ final Map 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 the element type */ private static class SetOperationCardinalityHelper extends CardinalityHelper implements Iterable { - + /** Contains the unique elements of the two collections. */ private final Set elements; - + /** Output collection. */ private final List newList; @@ -200,7 +200,7 @@ public class CollectionUtils { /** * Returns an immutable empty collection if the argument is null, * or the argument itself otherwise. - * + * * @param the element type * @param collection the collection, possibly null * @return an empty collection if the argument is null @@ -307,7 +307,7 @@ public class CollectionUtils { * Returns a new {@link Collection} containing a minus a subset of * b. Only the elements of b that satisfy the predicate * condition, p are subtracted from a. - * + * *

The cardinality of each element e in the returned {@link Collection} * that satisfies the predicate condition will be the cardinality of e in a * minus the cardinality of e in b, or zero, whichever is greater.

@@ -394,7 +394,7 @@ public class CollectionUtils { return true; } } - + /** * Returns true iff at least one element is in both collections. *

@@ -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()}. *

* This class can be used to store objects into a Map. - * + * * @param the element type * @since 4.0 */ private static class EquatorWrapper { private final Equator equator; private final O object; - + public EquatorWrapper(final Equator 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 obj in coll. * @@ -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 > List collate(final Collection a, final Collection b, @@ -1535,16 +1535,16 @@ public class CollectionUtils { * @param 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 List collate(final Collection a, final Collection b, final Comparator 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 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 List collate(final Collection a, final Collection b, final Comparator 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 { *

* For larger collections it is advised to use a {@link PermutationIterator} to * iterate over all permutations. - * + * * @see PermutationIterator - * + * * @param 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 Collection> permutations(final Collection collection) { final PermutationIterator it = new PermutationIterator(collection); diff --git a/src/main/java/org/apache/commons/collections4/IteratorUtils.java b/src/main/java/org/apache/commons/collections4/IteratorUtils.java index 19f15e649..22225b295 100644 --- a/src/main/java/org/apache/commons/collections4/IteratorUtils.java +++ b/src/main/java/org/apache/commons/collections4/IteratorUtils.java @@ -867,7 +867,6 @@ public class IteratorUtils { return new IteratorIterable(iterator, false); } - /** * Gets an iterable that wraps an iterator. The returned iterable can be * used for multiple iterations. diff --git a/src/main/java/org/apache/commons/collections4/ListUtils.java b/src/main/java/org/apache/commons/collections4/ListUtils.java index 2c91f8da2..95a439dbd 100644 --- a/src/main/java/org/apache/commons/collections4/ListUtils.java +++ b/src/main/java/org/apache/commons/collections4/ListUtils.java @@ -539,11 +539,13 @@ public class ListUtils { * @param 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 List longestCommonSubsequence(final List a, final List b, final Equator equator) { + public static List longestCommonSubsequence(final List a, final List b, + final Equator equator) { if (a == null || b == null) { throw new IllegalArgumentException("List must not be null"); } diff --git a/src/main/java/org/apache/commons/collections4/MapUtils.java b/src/main/java/org/apache/commons/collections4/MapUtils.java index afba05c5b..5824c98ac 100644 --- a/src/main/java/org/apache/commons/collections4/MapUtils.java +++ b/src/main/java/org/apache/commons/collections4/MapUtils.java @@ -1177,11 +1177,11 @@ public class MapUtils { } //----------------------------------------------------------------------- - + /** * Returns an immutable empty map if the argument is null, * or the argument itself otherwise. - * + * * @param the key type * @param the value type * @param map the map, possibly null @@ -1190,7 +1190,7 @@ public class MapUtils { public static Map emptyIfNull(final Map map) { return map == null ? Collections.emptyMap() : map; } - + /** * Null-safe check if the specified map is empty. *

@@ -1694,8 +1694,8 @@ public class MapUtils { * @param valueTransformer the Transformer used to transform the collection value into a value * @throws NullPointerException if the map, collection or transformers are null */ - public static void populateMap(final Map map, final Collection collection, - final Transformer keyTransformer, + public static void populateMap(final Map map, final Collection collection, + final Transformer keyTransformer, final Transformer valueTransformer) { final Iterator iter = collection.iterator(); while (iter.hasNext()) { @@ -1719,7 +1719,7 @@ public class MapUtils { final Transformer keyTransformer) { populateMap(map, collection, keyTransformer, TransformerUtils.nopTransformer()); } - + /** * Populates a MultiMap using the supplied Transformers to transform the collection * values into keys and values. @@ -1733,8 +1733,8 @@ public class MapUtils { * @param valueTransformer the Transformer used to transform the collection value into a value * @throws NullPointerException if the map, collection or transformers are null */ - public static void populateMap(final MultiMap map, final Collection collection, - final Transformer keyTransformer, + public static void populateMap(final MultiMap map, final Collection collection, + final Transformer keyTransformer, final Transformer valueTransformer) { final Iterator iter = collection.iterator(); while (iter.hasNext()) {