I have 2 approaches as below. Second one uses Sink. Both give same output.
Source<Integer, NotUsed> intSource = Source.range(1 ,7);
intSource.runForeach((elem) → {System.out.println(elem);}, mat);
Sink<Integer, CompletionStage> intSink = Sink.foreach((elem) → {System.out.println(elem);});
RunnableGraph graph = intSource.to(intSink);
graph.run(mat);
Which one to use when?What’s the conceptual difference between two?