- Close HTML tags
- Reduce whitespace
This commit is contained in:
Gary Gregory 2024-09-01 17:50:50 -04:00
parent d408ce68ac
commit 8f121670d4
1 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ import java.util.Objects;
* The iterables provided to the constructor are used in reverse order, each * The iterables provided to the constructor are used in reverse order, each
* until exhaustion before proceeding to the next element of the prior iterable * until exhaustion before proceeding to the next element of the prior iterable
* and repeating. Consider the following example: * and repeating. Consider the following example:
* * </p>
* <pre>{@code * <pre>{@code
* List<Character> iterable1 = Arrays.asList('A', 'B', 'C'); * List<Character> iterable1 = Arrays.asList('A', 'B', 'C');
* List<Character> iterable2 = Arrays.asList('1', '2', '3'); * List<Character> iterable2 = Arrays.asList('1', '2', '3');
@ -41,9 +41,9 @@ import java.util.Objects;
* System.out.println(tuple.get(0) + ", " + tuple.get(1)); * System.out.println(tuple.get(0) + ", " + tuple.get(1));
* } * }
* }</pre> * }</pre>
* * <p>
* The output will be: * The output will be:
* * </p>
* <pre> * <pre>
* A, 1 * A, 1
* A, 2 * A, 2
@ -58,10 +58,12 @@ import java.util.Objects;
* <p> * <p>
* The {@code remove()} operation is not supported, and will throw an * The {@code remove()} operation is not supported, and will throw an
* {@code UnsupportedOperationException}. * {@code UnsupportedOperationException}.
* </p>
* <p> * <p>
* If any of the input iterables is empty, the Cartesian product will be empty. * If any of the input iterables is empty, the Cartesian product will be empty.
* If any of the input iterables is infinite, the Cartesian product will be * If any of the input iterables is infinite, the Cartesian product will be
* infinite. * infinite.
* </p>
* *
* @param <E> the type of the objects being permuted * @param <E> the type of the objects being permuted
* @since 4.5.0 * @since 4.5.0
@ -127,7 +129,6 @@ public class CartesianProductIterator<E> implements Iterator<List<E>> {
if (!hasNext()) { if (!hasNext()) {
throw new NoSuchElementException(); throw new NoSuchElementException();
} }
if (previousTuple == null) { if (previousTuple == null) {
previousTuple = new ArrayList<>(iterables.size()); previousTuple = new ArrayList<>(iterables.size());
for (final Iterator<? extends E> iterator : iterators) { for (final Iterator<? extends E> iterator : iterators) {
@ -135,7 +136,6 @@ public class CartesianProductIterator<E> implements Iterator<List<E>> {
} }
return new ArrayList<>(previousTuple); return new ArrayList<>(previousTuple);
} }
for (int i = iterators.size() - 1; i >= 0; i--) { for (int i = iterators.size() - 1; i >= 0; i--) {
Iterator<? extends E> iterator = iterators.get(i); Iterator<? extends E> iterator = iterators.get(i);
if (iterator.hasNext()) { if (iterator.hasNext()) {