net.sf.morph.wrap
Interface IndexedContainer

All Superinterfaces:
Container, Sizable, Wrapper
All Known Subinterfaces:
DecoratedIndexedContainer, DecoratedMutableIndexedContainer, MutableIndexedContainer

public interface IndexedContainer
extends Container, Sizable

A wrapper for 'container-like' structures that have a logical ordering which can be used to retrieve elements at a specific index within the structure. Lists, SortedSets, and arrays are good examples of indexed structures. Note that some indexed structures will have O(1) methods for retrieving objects at a given index (ArrayList, TreeSet, array) and others will have O(n) methods for retrieving objects at a given index (LinkedList).

Since:
Jan 16, 2005
Author:
Matt Sgarlata

Method Summary
 java.lang.Object get(java.lang.Object container, int index)
          Gets the element at the specified index.
 
Methods inherited from interface net.sf.morph.wrap.Container
getContainedType, getIterator
 
Methods inherited from interface net.sf.morph.wrap.Wrapper
getWrappedObject
 
Methods inherited from interface net.sf.morph.wrap.Sizable
getSize
 
Methods inherited from interface net.sf.morph.wrap.Wrapper
getWrappedObject
 

Method Detail

get

java.lang.Object get(java.lang.Object container,
                     int index)
                     throws WrapperException
Gets the element at the specified index. Valid indexes range between 0 and one less than the container object's size, inclusive.

Parameters:
index - a number indiciating which element should be retrieved
Returns:
the object at the specified index
Throws:
WrapperException - if index is not a valid index for this container object or
the object at the specified index could not be retrieved for some reason


Copyright © 2004-2008.