@ SafeVarargs public final < OUT > DataStreamSource < OUT > fromElements ( Class < OUT > type , OUT ... data ) { if ( data . length == 0 ) { throw new IllegalArgumentException ( "fromElements needs at least one element as argument" ) ; } TypeInformation < OUT > typeInfo ; try { typeInfo = TypeExtractor . getForClass ( type ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not create TypeInformation for type " + type . getName ( ) + "; please specify the TypeInformation manually via " + "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)" , e ) ; } return fromCollection ( Arrays . asList ( data ) , typeInfo ) ; }
Creates a new data set that contains the given elements . The framework will determine the type according to the based type user supplied . The elements should be the same or be the subclass to the based type . The sequence of elements must not be empty . Note that this operation will result in a non - parallel data stream source i . e . a data stream source with a degree of parallelism one .