/** * Generates arrays of specified type T of fixed length * * @param length - fixed length * @return a Source of type T[] */ public Source<T[]> withLength(int length) { ArgumentAssertions.checkArguments( length >= 0, "The length of an array cannot be negative; %s is not an accepted argument", length); return Arrays.arraysOf(source, c, length); }
/** * Generates arrays of specified type T of length bounded inclusively between minimumSize and * maximumSize * * @param minimumSize - the inclusive minimum size of the array * @param maximumSize - the inclusive maximum size of the array * @return a Source of type T[] */ public Source<T[]> withLengthBetween(int minLength, int maxLength) { ArgumentAssertions.checkArguments( minLength <= maxLength, "The minLength (%s) is longer than the maxLength(%s)", minLength, maxLength); ArgumentAssertions.checkArguments( minLength >= 0, "The length of an array cannot be negative; %s is not an accepted argument", minLength); return Arrays.arraysOf(source, c, minLength, maxLength); }