|
|
## Write you own producer
|
|
|
|
|
|
The following code shows a simple producer stage. It takes a list of elements and sends them one by one to its output port.
|
|
|
The following code shows a simplified producer stage taken from the original [InitialElementProducer](https://build.se.informatik.uni-kiel.de/teetime/teetime/blob/master/src/main/java/teetime/stage/InitialElementProducer.java). It takes a list of elements and sends them one by one to its output port.
|
|
|
|
|
|
```java
|
|
|
public final class InitialElementProducer<T> extends AbstractProducerStage<T> {
|
|
|
public class InitialElementProducer<T> extends AbstractProducerStage<T> {
|
|
|
|
|
|
private Iterable<T> elements;
|
|
|
private final Collection<T> elements;
|
|
|
|
|
|
public InitialElementProducer(final Iterable<T> elements) {
|
|
|
public InitialElementProducer(final Collection<T> elements) {
|
|
|
this.elements = elements;
|
|
|
}
|
|
|
|
... | ... | |