... | ... | @@ -11,10 +11,6 @@ public final class InitialElementProducer<T> extends AbstractProducerStage<T> { |
|
|
|
|
|
private Iterable<T> elements;
|
|
|
|
|
|
public InitialElementProducer(final T... elements) {
|
|
|
this.elements = Arrays.asList(elements);
|
|
|
}
|
|
|
|
|
|
public InitialElementProducer(final Iterable<T> elements) {
|
|
|
this.elements = elements;
|
|
|
}
|
... | ... | @@ -43,5 +39,6 @@ It simply iterates over the given list and sends all elements by calling ``this. |
|
|
|
|
|
Furthermore, we want to check if the given iterable is not null.
|
|
|
This can be achieved by running a check while starting the stage.
|
|
|
For this, we overwrite the method ``onStarting`` and add a null check to it.
|
|
|
For this, we override the method ``onStarting`` and add a null check to it.
|
|
|
This method will be called once by the framework before it executes the stage for the first time.
|
|
|
You also need to make sure that the super method is also called. |
|
|
\ No newline at end of file |