GroupByKey with datasets in Spark 2.0 using Java
<p>I have a dataset containing data like the following:</p>

<pre><code>|c1| c2|
---------
| 1 | a |
| 1 | b |
| 1 | c |
| 2 | a |
| 2 | b |
</code></pre>

<p>...</p>

<p>Now, I want to get the data grouped like the following <strong>(col1: String Key, col2: List)</strong>:</p>

<pre><code>| c1| c2 |
-----------
| 1 |a,b,c|
| 2 | a, b|
...
</code></pre>

<p>I thought that using goupByKey would be an sufficient solution, but I can't find any example, how to use it.</p>

<p>Can anyone help me to find a solution using groupByKey or using any other combination of transformations and actions to get this output by using datasets, not RDD?</p>