Yields element at (0-based) position of the iterable.

@param <E> the iterable element type
@param index the element index
@param iterable the iterable that will be consumed
@return the element
546240
public static <E> E at(long index, Iterable<E> iterable) {
        dbc.precondition(iterable != null, "cannot call at with a null iterable");
        final Iterator<E> filtered = new FilteringIterator<E>(iterable.iterator(), new AtIndex<E>(index));
        return new FirstElement<E>().apply(filtered);
    }
602833
public E get(final int index) {
        final int sz = size();
        if (index < 0 || index >= sz) {
            throw new NoSuchElementException(
                String.format("The specified index (%1$d) is outside the available range [0, %2$d)",
                    Integer.valueOf(index), Integer.valueOf(sz)));
        }

        final int idx = (start + index) % maxElements;
        return elements[idx];
    }
1105309
public static <E> E at(long index, E[] array) {
        final Iterator<E> filtered = new FilteringIterator<E>(new ArrayIterator<E>(array), new AtIndex<E>(index));
        return new FirstElement<E>().apply(filtered);
    }
1072403
public Optional<E> get(int index) {
        return getOptional(linkedList)
                .filter(getGreaterSize(0).and(getGreaterSize(index)))
                .map(l -> l.get(index));
    }
186077
@Override
    public E set(int index, E element) {
        final ReentrantLock lock = this.lock;
        lock.lock();
        try {
            Object[] elements = getArray();
            E oldValue = get(elements, index);

            if (oldValue != element) {
                int len = elements.length;
                Object[] newElements = Arrays.copyOf(elements, len);
                newElements[index] = element;
                setArray(newElements);
            } else {
                // Not quite a no-op; ensures volatile write semantics
                setArray(elements);
            }
            return oldValue;
        } finally {
            lock.unlock();
        }
    }
1323107
public Object set(int index, Object element)
    {
        if ((index < m_iStartIndex) || (index >= m_iStartIndex + m_iMaxSize))
        { // Out of bounds, re-adjust bounds
            int iNewStart = index - m_iMaxSize / 2;   // index should be right in the middle
            if (iNewStart < 0)
                iNewStart = 0;
            int iStart = 0;
            int iEnd = this.size() - 1;
            int iIncrement = +1;
            if (iNewStart < m_iStartIndex)
            {   // Go backwards to avoid overlaying values
                iStart = iEnd;
                iEnd = 0;
                iIncrement = -1;
            }
            for (int i = iStart; i * iIncrement <= iEnd; i = i + iIncrement)
            {
                Object obj = super.set(i, null);                // Get and clear value
                int iShiftedIndex = i + m_iStartIndex - iNewStart;
                if ((iShiftedIndex >= 0) && (iShiftedIndex < this.size()))
                    super.set(iShiftedIndex, obj);              // Move/set it!
                else
                    this.freeObject(m_iStartIndex + i, obj);    // Notify obj
            }
            m_iStartIndex = iNewStart;
        }
        if (index >= m_iStartIndex + this.size())
        { // Need to add empty elements inbetween
            for (int i = m_iStartIndex + this.size(); i <= index; i++)
                this.add(null);     // Add a placeholder
        }
        index = index - m_iStartIndex;
        return super.set(index, element);
    }
357258
public Reactor getReactorByIndex(int index) {
		if (index < 0 || index > reactorSet.length - 1) {
			throw new ArrayIndexOutOfBoundsException();
		}
		return reactorSet[index];
	}
926613
public static Object getElementFromCollection(Collection<Object> collection, int index) {
    if (collection.size() < index + 1)
      return null;

    if (collection instanceof List)
      return ((List<Object>) collection).get(index);

    Iterator<Object> iterator = collection.iterator();
    for (int i = 0; i < index; i++) {
      iterator.next();
    }
    return iterator.next();
  }
829359
Node<E> node(int index) {
        // assert isElementIndex(index);

        if (index < (size >> 1)) {
            Node<E> x = first;
            for (int i = 0; i < index; i++)
                x = x.next;
            return x;
        } else {
            Node<E> x = last;
            for (int i = size - 1; i > index; i--)
                x = x.prev;
            return x;
        }
    }
1217261
@SuppressWarnings("unchecked")
    public T get(long index)
    {
        return (T) array[segment(index)][offset(index)];
    }
864280
public Object getArrayElement(Object o, int index) throws IndexOutOfBoundsException {
        if (o instanceof List)
            return ((List)o).get(index);
        return Array.get(o,index);
    }
976483
public static <T> int detectIndex(Iterable<T> iterable, Predicate<? super T> predicate)
    {
        if (iterable instanceof ArrayList<?>)
        {
            return ArrayListIterate.detectIndex((ArrayList<T>) iterable, predicate);
        }
        if (iterable instanceof List<?>)
        {
            return ListIterate.detectIndex((List<T>) iterable, predicate);
        }
        if (iterable != null)
        {
            return IterableIterate.detectIndex(iterable, predicate);
        }
        throw new IllegalArgumentException("Cannot perform detectIndex on null");
    }
818359
@Deprecated
    public E set(int index, E element) {
        return responses.set(index, element);
    }
1327277
public Iterable<String> get(String index, Iterable<String> keys) {
        Multimap<String, String> mmap = get(index);
        IterableChain<String> result = new IterableChain<String>();
        for (String key : keys) {
            result.addAll(mmap.get(key));
        }
        return result;
    }
531510
@Override
    public byte get(int index) {
        Preconditions.checkElementIndex(index, this.length, "index");
        return this.array[index + this.startOffset];
    }
820001
@SuppressWarnings("unchecked")
	public T get(int index) {
		T ret;
		if (JcRelation.class.equals(type)) {
			ret = (T) new JcRelation(null, this, OPERATOR.Collection.GET);
		} else if (JcNode.class.equals(type)) {
			ret = (T) new JcNode(null, this, OPERATOR.Collection.GET);
		} else {
			ret = (T) new JcValue(null, this, OPERATOR.Collection.GET);
		}
		ret.setHint(ValueAccess.hintKey_opValue, index);
		QueryRecorder.recordInvocationConditional(this, "get", ret, QueryRecorder.literal(index));
		return ret;
	}
1364949
@Pure
	public P getElementAt(int index) {
		if (index >= 0) {
			int idx = 0;
			int eIdx;
			for (final GridCell<P> cell : getGridCells()) {
				eIdx = idx + cell.getReferenceElementCount();
				if (index < eIdx) {
					try {
						return cell.getElementAt(index - idx);
					} catch (IndexOutOfBoundsException exception) {
						throw new IndexOutOfBoundsException(Integer.toString(index));
					}
				}
				idx = eIdx;
			}
		}
		throw new IndexOutOfBoundsException(Integer.toString(index));
	}