mirror of
https://github.com/apache/commons-math.git
synced 2025-02-08 02:59:36 +00:00
Reuse method from "MathArrays".
Merged "if" cases. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1520622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
451e121231
commit
034ed33e47
@ -131,16 +131,9 @@ public class Combinations implements Iterable<int[]> {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Iterator<int[]> iterator() {
|
||||
if (k == 0) {
|
||||
return new SingletonIterator(new int[]{});
|
||||
}
|
||||
if (k == n) {
|
||||
// TODO: once getNatural is extracted from RandomDataGenerator, use it
|
||||
final int[] natural = new int[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
natural[i] = i;
|
||||
}
|
||||
return new SingletonIterator(natural);
|
||||
if (k == 0 ||
|
||||
k == n) {
|
||||
return new SingletonIterator(MathArrays.natural(k));
|
||||
}
|
||||
|
||||
switch (iterationOrder) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user