public static class Combinations.LexicographicComparator extends Object implements Comparator<int[]>, Serializable
n) in the input array,
in reverse order.
For example if c is {3, 2, 1}, and n
is 3, the method will return 18.| Constructor and Description |
|---|
LexicographicComparator(int n,
int k) |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(int[] c1,
int[] c2) |
int |
getK()
Gets the number of elements in each combination.
|
int |
getN()
Gets the size of the set from which combinations are drawn.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic LexicographicComparator(int n,
int k)
n - Size of the set from which subsets are selected.k - Size of the subsets to be enumerated.public int getN()
public int getK()
public int compare(int[] c1,
int[] c2)
compare in interface Comparator<int[]>IllegalArgumentException - if the array lengths are not
equal to k.IllegalArgumentException - if an element of the array is not
within the interval [0, n).Copyright © 2017–2018 The Apache Software Foundation. All rights reserved.