Skip to content

Commit 4f8dbd6

Browse files
committed
Update PermutationIterator.java
1 parent 0ebdb1e commit 4f8dbd6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/cicirello/permutations/PermutationIterator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* JavaPermutationTools: A Java library for computation on permutations and sequences
3-
* Copyright 2005-2022 Vincent A. Cicirello, <https://www.cicirello.org/>.
3+
* Copyright 2005-2023 Vincent A. Cicirello, <https://www.cicirello.org/>.
44
*
55
* This file is part of JavaPermutationTools (https://jpt.cicirello.org/).
66
*
@@ -24,6 +24,7 @@
2424

2525
import java.util.Iterator;
2626
import java.util.NoSuchElementException;
27+
import org.cicirello.util.ArrayFiller;
2728

2829
/**
2930
* Iterator over all permutations of a specified length, n, of the integers in the interval [0,n).
@@ -63,8 +64,7 @@ public PermutationIterator(int n) {
6364
*/
6465
public PermutationIterator(Permutation p) {
6566
this.p = new Permutation(p);
66-
lastSwap = new int[p.length()];
67-
for (int i = 0; i < lastSwap.length; i++) lastSwap[i] = i;
67+
lastSwap = ArrayFiller.create(p.length());
6868
done = false;
6969
}
7070

0 commit comments

Comments
 (0)