public < OUT > DataStreamSource < OUT > fromCollection ( Collection < OUT > data ) { Preconditions . checkNotNull ( data , "Collection must not be null" ) ; if ( data . isEmpty ( ) ) { throw new IllegalArgumentException ( "Collection must not be empty" ) ; } OUT first = data . iterator ( ) . next ( ) ; if ( first == null ) { throw new IllegalArgumentException ( "Collection must not contain null elements" ) ; } TypeInformation < OUT > typeInfo ; try { typeInfo = TypeExtractor . getForObject ( first ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not create TypeInformation for type " + first . getClass ( ) + "; please specify the TypeInformation manually via " + "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)" , e ) ; } return fromCollection ( data , typeInfo ) ; }
Creates a data stream from the given non - empty collection . The type of the data stream is that of the elements in the collection .