title: Iterate though the contents of a Map<String,List<Object>> and assign the values of the List<Object> into separate List<Double>
body: <p>I have a <code>list</code> of objects that contain <code>coordinates</code> and a <code>name</code>. An example of the printed list can be seen below:</p>
  
  <pre><code>[X=0.1, Y=0.1, name=Series1]
  [X=0.1, Y=0.2, name=Series1]
  [X=0.1, Y=0.3, name=Series1]
  [X=0.1, Y=0.4, name=Series2]
  [X=0.1, Y=0.5, name=Series2]
  </code></pre>
  
  <p>What I'm trying to achieve is to group them together based on the <code>name</code> which can be done with the following Java 8 operation: </p>
  
  <pre><code>Map&lt;String, List&lt;Coordinates&gt;&gt; newList = coordinateList.stream()
             .collect(Collectors.groupingBy(Coordinates::getName));
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Series1=[[X=0.1, Y=0.1],[X=0.1, Y=0.2],[X=0.1, Y=0.3]]
  Series2=[[X=0.1, Y=0.4],[X=0.1, Y=0.5]]
  </code></pre>
  
  <p>The final step which I have not yet been able to achieve, is to iterate through the <code>Map</code>, create lists of <code>X's</code> and <code>Y's</code> so I can finally create a graph (<code>chart.addSeries(name, xData, yData);)</code>.</p>
  
  <p>My approach to this so far has been the following:</p>
  
  <pre><code>    List&lt;Double&gt; xData = new LinkedList&lt;Double&gt;();      
      List&lt;Double&gt; yData = new LinkedList&lt;Double&gt;();
  
      newList.forEach((k, v) -&gt; {
          //TO-DO
      });
  </code></pre>
  
  <p>Inside the <code>loop</code> I would like to assign <code>X's</code> and <code>Y's</code> to the corresponding <code>lists</code> but with no success so far.</p>
  
  <p>One of the problems is that <code>X</code> and <code>Y</code> are associated with a <code>Coordinates</code> object, so I cannot just add them to the <code>list</code> which is of type <code>Double</code>. Another problem I faced is that I cannot get <code>X</code> and <code>Y</code> separately from the <code>list</code>. I have tried <code>getX()</code> and <code>getY()</code> but with no luck.</p>
  
  <p>Example of what I would like the lists to contain:</p>
  
  <p>For the <code>key</code> <code>Series1</code> the generated <code>lists</code> would be the following:</p>
  
  <pre><code>xData=[0.1,0.1,0.1]
  yData=[0.1,0.2,0.3]
  </code></pre>
  
  <p>For the next key Series 2:</p>
  
  <pre><code>xData=[0.1,0.1]
  yData=[0.4,0.5]
  </code></pre>