Interface IndexedIterable<T>

All Superinterfaces:
Iterable<T>
All Known Implementing Classes:
CompositeIndexedIterable, ListIndexedIterable

public interface IndexedIterable<T> extends Iterable<T>
An iterable that also provides indexed access to the underlying collection.
Version:
$Revision$ $Date$
Author:
Nick Collier
  • Method Summary

    Modifier and Type
    Method
    Description
    get(int index)
    Gets the element at the specified position in this IndexedIterable.
    int
    Gets the number of elements in this IndexedIterable.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • get

      T get(int index)
      Gets the element at the specified position in this IndexedIterable. Note that this method is should be used for random access to the collection. iterator() is the preferred way to iterate through this IndexedIterable.
      Parameters:
      index - the index of the element to return
      Returns:
      the element at the specified position in this IndexedIterable.
      Throws:
      IndexOutOfBoundsException - if the given index is out of range (index < 0 || index >= size()).
    • size

      int size()
      Gets the number of elements in this IndexedIterable.
      Returns:
      the number of elements in this IndexedIterable.