code: public static void main(String[] args) throws Exception {
  		
  		if(!parseParameters(args)) {
  			return;
  		}
  		
  		// set up the execution environment
  		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  		
  		// get input data
  		DataSet<String> text = getTextDataSet(env);
  		
  		DataSet<Tuple2<String, Integer>> counts = 
  				// split up the lines in pairs (2-tuples) containing: (word,1)
  				text.flatMap(new Tokenizer())
  				// group by the tuple field "0" and sum up tuple field "1"
  				.groupBy(0)
  				.aggregate(Aggregations.SUM, 1);
  
  		// emit result
  		if(fileOutput) {
  			counts.writeAsCsv(outputPath, "\n", " ");
  		} else {
  			counts.print();
  		}
  		
  		// execute program
  		env.execute("WordCount Example");
  	}
docs: *************************************************************************