public static <T> void putAt(List<T> self, int idx, T value) {
        int size = self.size();
        idx = normaliseIndex(idx, size);
        if (idx < size) {
            self.set(idx, value);
        } else {
            while (size < idx) {
                self.add(size++, null);
            }
            self.add(idx, value);
        }
    }
public static < T > void putAt ( List < T > self , int idx , T value ) { int size = self . size ( ) ; idx = normaliseIndex ( idx , size ) ; if ( idx < size ) { self . set ( idx , value ) ; } else { while ( size < idx ) { self . add ( size ++ , null ) ; } self . add ( idx , value ) ; } }
A helper method to allow lists to work with subscript operators.
<pre class="groovyTestCase">def list = [2, 3]
list[0] = 1
assert list == [1, 3]</pre>

@param self  a List
@param idx   an index
@param value the value to put at the given index
@since 1.0