Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
- Close HTML tags
- Reduce whitespace
  • Loading branch information
garydgregory committed Sep 1, 2024
1 parent d408ce6 commit 8f12167
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The iterables provided to the constructor are used in reverse order, each
* until exhaustion before proceeding to the next element of the prior iterable
* and repeating. Consider the following example:
*
* </p>
* <pre>{@code
* List<Character> iterable1 = Arrays.asList('A', 'B', 'C');
* List<Character> iterable2 = Arrays.asList('1', '2', '3');
Expand All @@ -41,9 +41,9 @@
* System.out.println(tuple.get(0) + ", " + tuple.get(1));
* }
* }</pre>
*
* <p>
* The output will be:
*
* </p>
* <pre>
* A, 1
* A, 2
Expand All @@ -58,10 +58,12 @@
* <p>
* The {@code remove()} operation is not supported, and will throw an
* {@code UnsupportedOperationException}.
* </p>
* <p>
* 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
* infinite.
* </p>
*
* @param <E> the type of the objects being permuted
* @since 4.5.0
Expand Down Expand Up @@ -127,15 +129,13 @@ public List<E> next() {
if (!hasNext()) {
throw new NoSuchElementException();
}

if (previousTuple == null) {
previousTuple = new ArrayList<>(iterables.size());
for (final Iterator<? extends E> iterator : iterators) {
previousTuple.add(iterator.next());
}
return new ArrayList<>(previousTuple);
}

for (int i = iterators.size() - 1; i >= 0; i--) {
Iterator<? extends E> iterator = iterators.get(i);
if (iterator.hasNext()) {
Expand Down

0 comments on commit 8f12167

Please sign in to comment.