COM.FutureTense.Util
Class IterableIListWrapper

java.lang.Object
  extended by COM.FutureTense.Util.IListWrapper
      extended by COM.FutureTense.Util.IterableIListWrapper
All Implemented Interfaces:
IList, java.lang.Iterable<IList>

public class IterableIListWrapper
extends COM.FutureTense.Util.IListWrapper
implements IList, java.lang.Iterable<IList>

This class provides a lightweight wrapper over an IList object for the purpose of adding Iterable functionality to the IList.

The iterator() method of this class returns an iterator which exposes only a single row of the wrapped list for each call to the next() method. Attempting to mutate or clone the row view during iteration will result in an UnsupportedOperationException being thrown.

Typical usage of this class will likely resemble the following:

 IList manyRows = ics.SQL(...);
 for (IList row : new IterableIListWrapper(manyRows))
 {
     String idCol = row.getValue("id");
     String nameCol = row.getValue("name");
     String valueCol = row.getValue("value");
     String commentCol = row.getValue("comment");
     ...
 }
 

Note that the "rows" returned by the iterator are themselves IList objects. This way the data retrieval api is familiar to IList users - it's the same as with a non-iterable IList, except the iteration code is handled by Java instead of the developer.

Since:
7-Jul-2006 4:35:20 PM

Field Summary
 
Fields inherited from interface COM.FutureTense.Interfaces.IList
first, gotorow, last, next, prev
 
Constructor Summary
IterableIListWrapper(IList list)
           
 
Method Summary
 java.util.Iterator<IList> iterator()
          Return an Iterator over the IList.
 
Methods inherited from class COM.FutureTense.Util.IListWrapper
atEnd, clone, currentRow, flush, getColumnName, getFileData, getFileString, getIndirectColumnName, getName, getObject, getValue, hasData, moveTo, moveToRow, numColumns, numIndirectColumns, numRows, rename, stringInList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface COM.FutureTense.Interfaces.IList
atEnd, clone, currentRow, flush, getColumnName, getFileData, getFileString, getIndirectColumnName, getName, getObject, getValue, hasData, moveTo, moveToRow, numColumns, numIndirectColumns, numRows, rename, stringInList
 

Constructor Detail

IterableIListWrapper

public IterableIListWrapper(IList list)
Method Detail

iterator

public java.util.Iterator<IList> iterator()
Return an Iterator over the IList. IList objects are returned by the iterator's next() method, but these ILists have their rows locked to the current row. Attempts to move to another row, rename, flush, or clone the returned IList will result in an UnsupportedOperationException being thrown.

Specified by:
iterator in interface java.lang.Iterable<IList>
Returns:
iterator over the IList object. Each element is a view of the current IList, frozen at the current row.


Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.