| Modifier and Type | Method and Description |
|---|---|
static <T> Iterator<T> |
concurrentModifiable(List<T> sequence)
Returns an
Iterator over a sequence that allows new elements to
be added while the iteration is performed. |
static <T> T |
getFirst(Iterator<T> elements) |
static <T> T |
getFirst(Iterator<T> elements,
T defaultElement) |
static <T> Iterator<T> |
handleErrors(Iterator<T> fromIterator,
com.google.common.base.Function<Throwable,Void> errorHandlingFunction) |
static <T> Iterator<T> |
removeAll(BlockingQueue<T> fromQueue)
Returns an
Iterator that contains the elements from the queue. |
static <T> Iterator<T> |
until(Iterator<T> elements,
com.google.common.base.Predicate<T> predicate)
Returns the elements from the passed sequence up to the first element
that matches the passed predicate (this element is excluded from the
result sequence).
|
public static <T> Iterator<T> concurrentModifiable(List<T> sequence)
Iterator over a sequence that allows new elements to
be added while the iteration is performed.
The returned Iterator is using its own internal index and it is
up the client application to avoid inserting or removing elements to the
part of the sequence that has already been iterated over.
public static <T> Iterator<T> until(Iterator<T> elements, com.google.common.base.Predicate<T> predicate)
Returned Iterator will throw NoSuchElementException if
the predicate does not match for any element from the sequence.
public static <T> Iterator<T> removeAll(BlockingQueue<T> fromQueue)
Iterator that contains the elements from the queue.
The Iterator.next() method delegates to
BlockingQueue.take() and thus will block while the queue is
empty. The Iterator has an unbound size and
Iterator.hasNext() will only return false if the
BlockingQueue.take() call is interrupted.
public static <T> Iterator<T> handleErrors(Iterator<T> fromIterator, com.google.common.base.Function<Throwable,Void> errorHandlingFunction)
@ReturnsNullable public static <T> T getFirst(Iterator<T> elements)
@ReturnsNullable public static <T> T getFirst(Iterator<T> elements, @Nullable T defaultElement)
Copyright © 2009-2012 TranceCode. All Rights Reserved.