/** * Defines a lexicographic ordering of combinations. * The returned comparator allows to compare any two combinations * that can be produced by this instance's {@link #iterator() iterator}. * Its {@code compare(int[],int[])} method will throw exceptions if * passed combinations that are inconsistent with this instance: * <ul> * <li>{@code DimensionMismatchException} if the array lengths are not * equal to {@code k},</li> * <li>{@code OutOfRangeException} if an element of the array is not * within the interval [0, {@code n}).</li> * </ul> * @return a lexicographic comparator. */ public Comparator<int[]> comparator() { return new LexicographicComparator(n, k); }
/** * Defines a lexicographic ordering of combinations. * The returned comparator allows to compare any two combinations * that can be produced by this instance's {@link #iterator() iterator}. * Its {@code compare(int[],int[])} method will throw exceptions if * passed combinations that are inconsistent with this instance: * <ul> * <li>{@code DimensionMismatchException} if the array lengths are not * equal to {@code k},</li> * <li>{@code OutOfRangeException} if an element of the array is not * within the interval [0, {@code n}).</li> * </ul> * @return a lexicographic comparator. */ public Comparator<int[]> comparator() { return new LexicographicComparator(n, k); }
/** * Defines a lexicographic ordering of combinations. * The returned comparator allows to compare any two combinations * that can be produced by this instance's {@link #iterator() iterator}. * Its {@code compare(int[],int[])} method will throw exceptions if * passed combinations that are inconsistent with this instance: * <ul> * <li>{@code DimensionMismatchException} if the array lengths are not * equal to {@code k},</li> * <li>{@code OutOfRangeException} if an element of the array is not * within the interval [0, {@code n}).</li> * </ul> * @return a lexicographic comparator. */ public Comparator<int[]> comparator() { return new LexicographicComparator(n, k); }