setArrayValueWithGrowth<T> static method

List<T> setArrayValueWithGrowth<T>(
  1. List<T> array,
  2. int index,
  3. T value,
  4. T defaultValue,
)

Implementation

static List<T> setArrayValueWithGrowth<T>(
    List<T> array, int index, T value, T defaultValue) {
  if (index + 1 > array.length) {
    array = ensureArrayCapacity(array, index + 1, defaultValue);
  }
  array[index] = value;
  return array;
}