com.atlassian.confluence.util
Class SingleUseIterable<T>

java.lang.Object
  extended by com.atlassian.confluence.util.SingleUseIterable<T>
All Implemented Interfaces:
Iterable<T>

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

An Iterable wrapper for an iterator. If the iterator is retrieved more than once, an exception will be thrown.


Method Summary
static
<T> SingleUseIterable<T>
create(Iterator<T> iterator)
          Convenience static factory because constructors can't infer generic types.
 Iterator<T> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <T> SingleUseIterable<T> create(Iterator<T> iterator)
Convenience static factory because constructors can't infer generic types.

Parameters:
iterator - the iterator to wrap
Returns:
the appropriately typed SingleUseIterator

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>


Copyright © 2003–2015 Atlassian. All rights reserved.