title: Adding XYChart.Series<Integer,Integer> into linechart for javafx
body: <pre><code>public static XYChart.Series&lt;Integer,Integer&gt; makeSeries(ArrayList&lt;Integer&gt; date, ArrayList&lt;Integer&gt; cases) {
  
      XYChart.Series&lt;Integer,Integer&gt; series = new XYChart.Series&lt;&gt;();
      for(int i = 0; i &lt; date.size();i++) {
          series.getData().add(new XYChart.Data&lt;Integer,Integer&gt;(date.get(i), cases.get(i))); 
      }
      return series;
  
  }
  
  public static LineChart&lt;Number, Number&gt; makeChart(ArrayList&lt;XYChart.Series&lt;Integer,Integer&gt;&gt; series) {
      NumberAxis xAxis = new NumberAxis(); 
      NumberAxis yAxis = new NumberAxis(); 
      LineChart&lt;Number, Number&gt; linechart = new LineChart&lt;Number, Number&gt;(xAxis, yAxis); 
  
      for(int i = 0; i &lt; series.size();i++) {
          Series&lt;Integer, Integer&gt; num = series.get(i);
          linechart.getData().add(series.get(i));
      }
      return linechart;
  }
  </code></pre>
  
  <p>So I have difficulty adding the data in the series to the line chart, it wouldn't let me use the add method.</p>
  
  <p>The error message I got was: </p>
  
  <pre class="lang-none prettyprint-override"><code>The method add(XYChart.Series&lt;Number,Number&gt;) in the type List&lt;XYChart.Series&lt;Number,Number&gt;&gt; is not applicable for the arguments (XYChart.Series&lt;Integer,Integer&gt;)
  </code></pre>
  
  <p>I've also tried to type cast the <code>series.get(i)</code> into <code>Number</code> but it also doesn't seem to work... </p>
  
  <p>Any help would be highly appreciated! Thank you!</p>