CS 1705 Library

cs1705
Class IterableSequence<T>

java.lang.Object
  extended by cs1705.IterableSequence<T>
Type Parameters:
T - The type of elements contained in this sequence
All Implemented Interfaces:
Iterable<T>

public class IterableSequence<T>
extends Object
implements Iterable<T>

This class is just an iterator wrapped inside an Iterable so that it can be used in for-each loops.

Version:
2007.07.26
Author:
Stephen Edwards

Constructor Summary
IterableSequence(Iterator<T> iterator)
          Creates a new IterableSequence.
 
Method Summary
 Iterator<T> iterator()
          Returns an iterator over a set of elements of type T.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterableSequence

public IterableSequence(Iterator<T> iterator)
Creates a new IterableSequence.

Parameters:
iterator - The iterator to wrap
Method Detail

iterator

public Iterator<T> iterator()
Returns an iterator over a set of elements of type T.

Specified by:
iterator in interface Iterable<T>
Returns:
an iterator

Last updated: Wed, Apr 1, 2009 • 12:29 AM EDT

Copyright © 2009 Virginia Tech.