net.fortytwo.flow
Class Collector<T,E extends Exception>

java.lang.Object
  extended by net.fortytwo.flow.SimpleReadOnlyCollection<T>
      extended by net.fortytwo.flow.Collector<T,E>
All Implemented Interfaces:
Iterable<T>, Collection<T>, Sink<T,E>, Source<T,E>
Direct Known Subclasses:
Buffer

public class Collector<T,E extends Exception>
extends SimpleReadOnlyCollection<T>
implements Sink<T,E>, Source<T,E>

Note: while this class is not actually thread-safe, put() may safely be called while writeTo() is in progress.


Constructor Summary
Collector()
           
 
Method Summary
 void clear()
           
 Iterator<T> iterator()
           
 void put(T t)
           
 int size()
           
 void writeTo(Sink<T,E> sink)
           
 
Methods inherited from class net.fortytwo.flow.SimpleReadOnlyCollection
add, addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

Collector

public Collector()
Method Detail

put

public void put(T t)
         throws E extends Exception
Specified by:
put in interface Sink<T,E extends Exception>
Throws:
E extends Exception

writeTo

public void writeTo(Sink<T,E> sink)
             throws E extends Exception
Specified by:
writeTo in interface Source<T,E extends Exception>
Throws:
E extends Exception

size

public int size()
Specified by:
size in interface Collection<T>

iterator

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

clear

public void clear()
Specified by:
clear in interface Collection<T>
Overrides:
clear in class SimpleReadOnlyCollection<T>


Copyright © 2007-2011 fortytwo.net. All Rights Reserved.