com.sas.util
Interface IndexedGetInterface

All Superinterfaces:
com.sas.util.Countable
All Known Subinterfaces:
IndexedSetInterface, com.sas.collection.OrderedCollectionInterface, SelectionGroupInterface, com.sas.collection.StaticOrderedCollectionInterface
All Known Implementing Classes:
ArrayAccess, com.sas.collection.OrderedCollection, SelectionGroup, VectorAccess

public interface IndexedGetInterface
extends com.sas.util.Countable

IndexedGetInterface is an interface which defines a get(int index) method, commonly used for retrieving objects from indexed collections. Note that some objects may implement IndexedGetInterface but may chose not to implement IndexedSetInterface.

The object must also implement the Countable interface which defines the valid range of indices. Most objects use zero based indexing and thus the valid set of indices would be 0..count()-1.

Usage

 for (int i = 0, count = x.count(); i < count; i++) {
    Object o = x.get(i);
    // operate on o
 }
 

See Also:
Countable, StaticOrderedCollectionInterface, IndexedSetInterface

Method Summary
 java.lang.Object get(int index)
          Get a value via an integer index.
 
Methods inherited from interface com.sas.util.Countable
count
 

Method Detail

get

java.lang.Object get(int index)
Get a value via an integer index. This is like an array reference.

Parameters:
index - the index of the item to fetch.
Returns:
Object the object associated with the index.
Throws:
java.lang.IndexOutOfBoundsException - The implementor of this interface may throw this RuntimeException if the index is not valid.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.