Support the subscript operator for a List.
<pre class="groovyTestCase">def list = [2, "a", 5.3]
assert list[1] == "a"</pre>

@param self a List
@param idx  an index
@return the value at the given index
@since 1.0
326678
public static <T> T getAt(List<T> self, int idx) {
        int size = self.size();
        int i = normaliseIndex(idx, size);
        if (i < size) {
            return self.get(i);
        } else {
            return null;
        }
    }
398564
def select(self, idx):
        
        data = {}
        for k in self.data:
            data[k] = self.data[k][idx]
        return self._return(data=data)
1135702
public int getDepth(int index) {
    if (index == 0) {
      return 0;
    } else {
      int[] parts = findSubexpression(index);
      return 1 + subexpressions.get(parts[0]).getDepth(parts[1]);
    }
  }
14417
public static <T> PositionFactory<Iterable<? extends T>, T> atIndex(final int index) {
        return new PositionFactory<Iterable<? extends T>, T>(index) {

            @Override
            public String toString() {
                return String.format("Element [%s]", index);
            }

            @Override
            protected <P> Type evaluateElementType(Position<P> parentPosition) {
                return TypeUtils.getTypeArguments(parentPosition.getType(), Iterable.class)
                    .get(Iterable.class.getTypeParameters()[0]);
            }
        };
    }
121377
public static double dArrayGet(double[] a, int i) {
        try {
            return a[i];
        } catch (Throwable t) {
            return a[DefaultGroovyMethodsSupport.normaliseIndex(i,a.length)];
        }
    }
330730
def getIndexedValue(self, index):
        
        actions = self._actions

        if (type (actions) is list):
            dict = actions[index]
        else:
            dict = actions
        return dict.get('value', 'NoValue')
64531
def get_idxs(exprs):
    
    idxs = set()
    for expr in (exprs):
        for i in expr.find(sympy.Idx):
            idxs.add(i)
    return sorted(idxs, key=str)
973729
def _assertIndex(self, index):
        
        if type(index) is not int:
            raise TypeError('list indices must be integers')
        if index < 0 or index >= self.nelems:
            raise IndexError('list index out of range')
583757
def get(self, idx, default=''):
        ''''''
        # if the index is beyond the length of the list, return ''
        if isinstance(idx, int) and (idx >= len(self) or idx < -1 * len(self)):
            return default
        # else do the regular list function (for int, slice types, etc.)
        return super().__getitem__(idx)
639350
public long getIdx(int[] indices){
		long idx=0;
		int i=indices.length-1;

		for(int j=0;i>0&&j<indices.length-1;i--,j++)
			idx += indices[i]*dim[j];
		idx += indices[0];
		return idx;
	}
1301128
private static String getValue(String[] cols, int idx) {
        if (cols == null || idx >= cols.length)
            return null;
        return cols[idx];
    }
80776
@Override
  public ImmutableList<E> subList(int fromIndex, int toIndex) {
    checkPositionIndexes(fromIndex, toIndex, size());
    int length = toIndex - fromIndex;
    if (length == size()) {
      return this;
    }
    switch (length) {
      case 0:
        return of();
      case 1:
        return of(get(fromIndex));
      default:
        return subListUnchecked(fromIndex, toIndex);
    }
  }
28070
public float remove(int idx)	{
		float ret = -1f;
		int p = Arrays.binarySearch(index,0,length, idx);
		if (p >= 0)	{
			System.arraycopy(data, p+1, data, p, length-p-1);
			System.arraycopy(index, p+1, index, p, length-p-1);
			length--;
		}else{
			System.err.println("error");
		}
		return ret;
	}
981846
@Override
	public CallSequence get(int index)
	{
		if (indics == null)
		{
			size();
		}
		Pair<Integer, Integer> v = indics.get(index);

		int r = v.first;

		if (r == 0)
		{
			CallSequence seq = getVariables();
			seq.add(AstFactory.newASkipStm(new LexLocation()));
			return seq;

		} else
		{

			TestSequence rtests = repeat.getTests();
			int count = rtests.size();
			int[] c = new int[r];

			for (int i = 0; i < r; i++)
			{
				c[i] = count;
			}

			Permutor p = new Permutor(c);
			int[] select = null;
			for (int i = 0; i < v.second; i++)
			{
				select = p.next();
			}

			CallSequence seq = getVariables();

			for (int i = 0; i < r; i++)
			{
				seq.addAll(rtests.get(select[i]));
			}
			return seq;
		}

	}
128906
public static Iterator iterator(final MutableComboBoxModel self) {
        return new Iterator() {
            private int index = 0;

            public boolean hasNext() {
                return index > -1 && index < self.getSize();
            }

            public Object next() {
                return self.getElementAt(index++);
            }

            public void remove() {
                if (hasNext()) self.removeElementAt(index--);
            }
        };
    }
1272958
public static void setIndex(Matcher matcher, int idx) {
        int count = getCount(matcher);
        if (idx < -count || idx >= count) {
            throw new IndexOutOfBoundsException("index is out of range " + (-count) + ".." + (count - 1) + " (index = " + idx + ")");
        }
        if (idx == 0) {
            matcher.reset();
        } else if (idx > 0) {
            matcher.reset();
            for (int i = 0; i < idx; i++) {
                matcher.find();
            }
        } else if (idx < 0) {
            matcher.reset();
            idx += getCount(matcher);
            for (int i = 0; i < idx; i++) {
                matcher.find();
            }
        }
    }
225273
public static List<String> toList(CharSequence self) {
        String s = self.toString();
        int size = s.length();
        List<String> answer = new ArrayList<String>(size);
        for (int i = 0; i < size; i++) {
            answer.add(s.substring(i, i + 1));
        }
        return answer;
    }