public final class IndicesValidator
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isSubset(int len,
int[] indices)
Validates that the passed in is a sub-set of all indices from 0 to len-1.
|
static boolean |
isWholeset(int length,
int[] indices)
Validates that the passed in is a whole set of all indices from 0 to n.
|
public static boolean isSubset(int len, int[] indices)
len
- The maximum index value.indices
- The array of indices to validate.true
if indices has values from 0 to indices.length - 1, and
every number occur at most once. Otherwise, false
.public static boolean isWholeset(int length, int[] indices)
length
- the length of the whole set of indices.indices
- The array of indices to validatetrue
if indices has values from 0 to indices.length, and every
number occur once and only once. Otherwise, false
.