public <X> DataSource<X> fromCollection(Collection<X> data) {
		if (data == null) {
			throw new IllegalArgumentException("The data must not be null.");
		}
		if (data.size() == 0) {
			throw new IllegalArgumentException("The size of the collection must not be empty.");
		}
		
		X firstValue = data.iterator().next();
		
		return fromCollection(data, TypeExtractor.getForObject(firstValue));
	}
public < X > DataSource < X > fromCollection ( Collection < X > data ) { if ( data == null ) { throw new IllegalArgumentException ( "The data must not be null." ) ; } if ( data . size ( ) == 0 ) { throw new IllegalArgumentException ( "The size of the collection must not be empty." ) ; } X firstValue = data . iterator ( ) . next ( ) ; return fromCollection ( data , TypeExtractor . getForObject ( firstValue ) ) ; }
Creates a DataSet from the given non-empty collection. The type of the data set is that
of the elements in the collection. The elements need to be serializable (as defined by
{@link java.io.Serializable}), because the framework may move the elements into the cluster
if needed.
<p>
The framework will try and determine the exact type from the collection elements.
In case of generic elements, it may be necessary to manually supply the type information
via {@link #fromCollection(Collection, TypeInformation)}.
<p>
Note that this operation will result in a non-parallel data source, i.e. a data source with
a degree of parallelism of one.

@param data The collection of elements to create the data set from.
@return A DataSet representing the given collection.

@see #fromCollection(Collection, TypeInformation)