/** * Creates a data stream from the given iterator. * * <p>Because the iterator will remain unmodified until the actual execution happens, * the type of data returned by the iterator must be given explicitly in the form of the type * information. This method is useful for cases where the type is generic. * In that case, the type class (as given in * {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information. * * <p>Note that this operation will result in a non-parallel data stream source, i.e., * a data stream source with parallelism one. * * @param data * The iterator of elements to create the data stream from * @param typeInfo * The TypeInformation for the produced data stream * @param <OUT> * The type of the returned data stream * @return The data stream representing the elements in the iterator */ public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }
/** * Creates a data stream from the given iterator. * * <p>Because the iterator will remain unmodified until the actual execution happens, * the type of data returned by the iterator must be given explicitly in the form of the type * information. This method is useful for cases where the type is generic. * In that case, the type class (as given in * {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information. * * <p>Note that this operation will result in a non-parallel data stream source, i.e., * a data stream source with parallelism one. * * @param data * The iterator of elements to create the data stream from * @param typeInfo * The TypeInformation for the produced data stream * @param <OUT> * The type of the returned data stream * @return The data stream representing the elements in the iterator */ public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }
/** * Creates a data stream from the given iterator. * * <p>Because the iterator will remain unmodified until the actual execution happens, * the type of data returned by the iterator must be given explicitly in the form of the type * information. This method is useful for cases where the type is generic. * In that case, the type class (as given in * {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information. * * <p>Note that this operation will result in a non-parallel data stream source, i.e., * a data stream source with parallelism one. * * @param data * The iterator of elements to create the data stream from * @param typeInfo * The TypeInformation for the produced data stream * @param <OUT> * The type of the returned data stream * @return The data stream representing the elements in the iterator */ public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }
/** * Creates a data stream from the given iterator. * * <p>Because the iterator will remain unmodified until the actual execution happens, * the type of data returned by the iterator must be given explicitly in the form of the type * information. This method is useful for cases where the type is generic. * In that case, the type class (as given in * {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information. * * <p>Note that this operation will result in a non-parallel data stream source, i.e., * a data stream source with parallelism one. * * @param data * The iterator of elements to create the data stream from * @param typeInfo * The TypeInformation for the produced data stream * @param <OUT> * The type of the returned data stream * @return The data stream representing the elements in the iterator */ public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }
/** * Creates a data stream from the given iterator. * * <p>Because the iterator will remain unmodified until the actual execution happens, * the type of data returned by the iterator must be given explicitly in the form of the type * information. This method is useful for cases where the type is generic. * In that case, the type class (as given in * {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information. * * <p>Note that this operation will result in a non-parallel data stream source, i.e., * a data stream source with a parallelism one. * * @param data * The iterator of elements to create the data stream from * @param typeInfo * The TypeInformation for the produced data stream * @param <OUT> * The type of the returned data stream * @return The data stream representing the elements in the iterator */ public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }