Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
Close HTML tags
  • Loading branch information
garydgregory committed Feb 3, 2024
1 parent 51cc646 commit 9d13951
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/main/java/org/apache/commons/collections4/IterableUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public Iterator<Object> iterator() {
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to limit, may not be null
Expand Down Expand Up @@ -111,9 +112,11 @@ public Iterator<E> iterator() {
* The returned iterable has an iterator that traverses the elements in the order
* of the arguments, i.e. iterables[0], iterables[1], .... The source iterators
* are not polled until necessary.
* </p>
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param iterables the iterables to combine, may not be null
Expand Down Expand Up @@ -144,9 +147,11 @@ protected Iterator<? extends E> nextIterator(final int count) {
* The returned iterable has an iterator that traverses the elements in {@code a},
* followed by the elements in {@code b}. The source iterators are not polled until
* necessary.
* </p>
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param a the first iterable, may not be null
Expand All @@ -166,9 +171,11 @@ public static <E> Iterable<E> chainedIterable(final Iterable<? extends E> a,
* The returned iterable has an iterator that traverses the elements in {@code a},
* followed by the elements in {@code b} and {@code c}. The source iterators are
* not polled until necessary.
* </p>
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param a the first iterable, may not be null
Expand All @@ -190,9 +197,11 @@ public static <E> Iterable<E> chainedIterable(final Iterable<? extends E> a,
* The returned iterable has an iterator that traverses the elements in {@code a},
* followed by the elements in {@code b}, {@code c} and {@code d}. The source
* iterators are not polled until necessary.
* </p>
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param a the first iterable, may not be null
Expand Down Expand Up @@ -240,6 +249,7 @@ static void checkNotNull(final Iterable<?>... iterables) {
* <p>
* The returned iterable's iterator supports {@code remove()} when the
* corresponding input iterator supports it.
* </p>
*
* @param <E> the element type
* @param comparator the comparator defining an ordering over the elements,
Expand Down Expand Up @@ -267,6 +277,7 @@ public Iterator<E> iterator() {
* <p>
* The returned iterable's iterator supports {@code remove()} when the
* corresponding input iterator supports it.
* </p>
*
* @param <E> the element type
* @param a the first iterable, must not be null
Expand Down Expand Up @@ -294,6 +305,7 @@ public Iterator<E> iterator() {
* A {@code null} object will not be passed to the equator, instead a
* {@link org.apache.commons.collections4.functors.NullPredicate NullPredicate}
* will be used.
* </p>
*
* @param <E> the type of object the {@link Iterable} contains
* @param iterable the iterable to check, may be null
Expand All @@ -312,6 +324,7 @@ public static <E> boolean contains(final Iterable<? extends E> iterable, final E
* Checks if the object is contained in the given iterable.
* <p>
* A {@code null} or empty iterable returns false.
* </p>
*
* @param <E> the type of object the {@link Iterable} contains
* @param iterable the iterable to check, may be null
Expand All @@ -329,6 +342,7 @@ public static <E> boolean contains(final Iterable<E> iterable, final Object obje
* Counts the number of elements in the input iterable that match the predicate.
* <p>
* A {@code null} iterable matches no elements.
* </p>
*
* @param <E> the type of object the {@link Iterable} contains
* @param input the {@link Iterable} to get the input from, may be null
Expand Down Expand Up @@ -357,6 +371,7 @@ public static <E> Iterable<E> emptyIfNull(final Iterable<E> iterable) {
* Gets an empty iterable.
* <p>
* This iterable does not contain any elements.
* </p>
*
* @param <E> the element type
* @return an empty iterable
Expand Down Expand Up @@ -384,6 +399,7 @@ private static <E> Iterator<E> emptyIteratorIfNull(final Iterable<E> iterable) {
* <p>
* The returned iterable's iterator supports {@code remove()} when the
* corresponding input iterator supports it.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to filter, may not be null
Expand All @@ -407,6 +423,7 @@ public Iterator<E> iterator() {
* Finds the first element in the given iterable which matches the given predicate.
* <p>
* A {@code null} or empty iterator returns null.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to search, may be null
Expand Down Expand Up @@ -454,6 +471,7 @@ public static <E> void forEach(final Iterable<E> iterable, final Closure<? super
* Executes the given closure on each but the last element in the iterable.
* <p>
* If the input iterable is null no change is made.
* </p>
*
* @param <E> the type of object the {@link Iterable} contains
* @param iterable the iterable to get the input from, may be null
Expand Down Expand Up @@ -488,6 +506,7 @@ public static <E, T extends E> int frequency(final Iterable<E> iterable, final T
* {@code IndexOutOfBoundsException} if there is no such element.
* <p>
* If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
* </p>
*
* @param <T> the type of object in the {@link Iterable}.
* @param iterable the {@link Iterable} to get a value from, may be null
Expand All @@ -508,6 +527,7 @@ public static <T> T get(final Iterable<T> iterable, final int index) {
* matches the given predicate.
* <p>
* A {@code null} or empty iterable returns -1.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to search, may be null
Expand All @@ -523,6 +543,7 @@ public static <E> int indexOf(final Iterable<E> iterable, final Predicate<? supe
* Answers true if the provided iterable is empty.
* <p>
* A {@code null} iterable returns true.
* </p>
*
* @param iterable the {@link Iterable to use}, may be null
* @return true if the iterable is null or empty, false otherwise
Expand All @@ -543,6 +564,7 @@ public static boolean isEmpty(final Iterable<?> iterable) {
* cycles omit the removed element, which is no longer in {@code iterable}. The
* iterator's {@code hasNext()} method returns {@code true} until {@code iterable}
* is empty.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to loop, may not be null
Expand Down Expand Up @@ -571,6 +593,7 @@ protected Iterator<? extends E> nextIterator(final int count) {
* Answers true if a predicate is true for every element of an iterable.
* <p>
* A {@code null} or empty iterable returns true.
* </p>
*
* @param <E> the type of object the {@link Iterable} contains
* @param iterable the {@link Iterable} to use, may be null
Expand All @@ -587,6 +610,7 @@ public static <E> boolean matchesAll(final Iterable<E> iterable, final Predicate
* Answers true if a predicate is true for any element of the iterable.
* <p>
* A {@code null} or empty iterable returns false.
* </p>
*
* @param <E> the type of object the {@link Iterable} contains
* @param iterable the {@link Iterable} to use, may be null
Expand All @@ -605,6 +629,7 @@ public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate
* For each predicate, the returned list will contain a collection holding
* all elements of the input iterable matching the predicate. The last collection
* contained in the list will hold all elements which didn't match any predicate:
* </p>
* <pre>
* [C1, C2, R] = partition(I, P1, P2) with
* I = input
Expand All @@ -617,14 +642,17 @@ public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate
* <p>
* <b>Note</b>: elements are only added to the output collection of the first matching
* predicate, determined by the order of arguments.
* </p>
* <p>
* If the input iterable is {@code null}, the same is returned as for an
* empty iterable.
* If no predicates have been provided, all elements of the input collection
* will be added to the rejected collection.
* </p>
* <p>
* Example: for an input list [1, 2, 3, 4, 5] calling partition with predicates [x &lt; 3]
* and [x &lt; 5] will result in the following output: [[1, 2], [3, 4], [5]].
* </p>
*
* @param <O> the type of object the {@link Iterable} contains
* @param <R> the type of the output {@link Collection}
Expand Down Expand Up @@ -694,6 +722,7 @@ public static <O, R extends Collection<O>> List<R> partition(final Iterable<? ex
* For each predicate, the result will contain a list holding all elements of the
* input iterable matching the predicate. The last list will hold all elements
* which didn't match any predicate:
* </p>
* <pre>
* [C1, R] = partition(I, P1) with
* I = input
Expand All @@ -704,9 +733,11 @@ public static <O, R extends Collection<O>> List<R> partition(final Iterable<? ex
* <p>
* If the input iterable is {@code null}, the same is returned as for an
* empty iterable.
* </p>
* <p>
* Example: for an input list [1, 2, 3, 4, 5] calling partition with a predicate [x &lt; 3]
* will result in the following output: [[1, 2], [3, 4, 5]].
* </p>
*
* @param <O> the type of object the {@link Iterable} contains
* @param iterable the iterable to partition, may be null
Expand All @@ -731,6 +762,7 @@ public static <O> List<List<O>> partition(final Iterable<? extends O> iterable,
* For each predicate, the result will contain a list holding all elements of the
* input iterable matching the predicate. The last list will hold all elements
* which didn't match any predicate:
* </p>
* <pre>
* [C1, C2, R] = partition(I, P1, P2) with
* I = input
Expand All @@ -743,12 +775,15 @@ public static <O> List<List<O>> partition(final Iterable<? extends O> iterable,
* <p>
* <b>Note</b>: elements are only added to the output collection of the first matching
* predicate, determined by the order of arguments.
* </p>
* <p>
* If the input iterable is {@code null}, the same is returned as for an
* empty iterable.
* </p>
* <p>
* Example: for an input list [1, 2, 3, 4, 5] calling partition with predicates [x &lt; 3]
* and [x &lt; 5] will result in the following output: [[1, 2], [3, 4], [5]].
* </p>
*
* @param <O> the type of object the {@link Iterable} contains
* @param iterable the collection to get the input from, may be null
Expand All @@ -770,9 +805,11 @@ public static <O> List<List<O>> partition(final Iterable<? extends O> iterable,
* In case the provided iterable is a {@link List} instance, a
* {@link ReverseListIterator} will be used to reverse the traversal
* order, otherwise an intermediate {@link List} needs to be created.
* </p>
* <p>
* The returned iterable's iterator supports {@code remove()} if the
* provided iterable is a {@link List} instance.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to use, may not be null
Expand All @@ -797,6 +834,7 @@ public Iterator<E> iterator() {
* Returns the number of elements contained in the given iterator.
* <p>
* A {@code null} or empty iterator returns {@code 0}.
* </p>
*
* @param iterable the iterable to check, may be null
* @return the number of elements contained in the iterable
Expand All @@ -816,6 +854,7 @@ public static int size(final Iterable<?> iterable) {
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to use, may not be null
Expand Down Expand Up @@ -856,6 +895,7 @@ public static <E> List<E> toList(final Iterable<E> iterable) {
* enclosed in square brackets ({@code "[]"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Elements are
* converted to strings as by {@code String.valueOf(Object)}.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to convert to a string, may be null
Expand All @@ -872,6 +912,7 @@ public static <E> String toString(final Iterable<E> iterable) {
* enclosed in square brackets ({@code "[]"}). Adjacent elements are separated
* by the characters {@code ", "} (a comma followed by a space). Elements are
* converted to strings as by using the provided {@code transformer}.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to convert to a string, may be null
Expand All @@ -892,6 +933,7 @@ public static <E> String toString(final Iterable<E> iterable,
* enclosed by the provided {@code prefix} and {@code suffix}. Adjacent elements
* are separated by the provided {@code delimiter}. Elements are converted to
* strings as by using the provided {@code transformer}.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to convert to a string, may be null
Expand All @@ -917,6 +959,7 @@ public static <E> String toString(final Iterable<E> iterable,
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <I> the input element type
* @param <O> the output element type
Expand All @@ -943,6 +986,7 @@ public Iterator<O> iterator() {
* The returned iterable's iterator supports {@code remove()} when the
* corresponding input iterator supports it. Calling {@code remove()}
* will only remove a single element from the underlying iterator.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to use, may not be null
Expand All @@ -963,6 +1007,7 @@ public Iterator<E> iterator() {
* Returns an unmodifiable view of the given iterable.
* <p>
* The returned iterable's iterator does not support {@code remove()}.
* </p>
*
* @param <E> the element type
* @param iterable the iterable to use, may not be null
Expand All @@ -983,9 +1028,11 @@ public static <E> Iterable<E> unmodifiableIterable(final Iterable<E> iterable) {
* The returned iterable has an iterator that traverses the elements in {@code a}
* and {@code b} in alternating order. The source iterators are not polled until
* necessary.
* </p>
* <p>
* The returned iterable's iterator supports {@code remove()} when the corresponding
* input iterator supports it.
* </p>
*
* @param <E> the element type
* @param a the first iterable, may not be null
Expand Down

0 comments on commit 9d13951

Please sign in to comment.