title: Parse integer list from Scenario outline's example table in cucumber java
body: <p>I have to write a BDD test using cucumber with java and I would like to parse an integer list from every line of my example table and pass this list to my step method using the latest version of cucumber (4.2.6). 
  So I got the following step definition in my feature file:</p>
  
  <pre><code>Scenario Outline: Some scenarion
      Given a list of integer: &lt;integer_list&gt; 
  
      Examples:
        | integer_list   |
        | 2, 3, 5, 6     | 
        | 3, 12, 45, 5, 6| 
  </code></pre>
  
  <p>And I would need something like this in my code:</p>
  
  <pre><code>   @Given("a list of integer: (\\d+.)")
      public void storeIntegerList(List&lt;Integer&gt; integers) {
       System.out.println(integers.size());
      }
  </code></pre>
  
  <p>Unfortunately, I can't find a way to handle parse these values into a list. It's either doesn't find the step method (I've tried lots of different regexp) or throws an exception where inform me that my numbers can't be transformed to a list. </p>
  
  <p>As a workaround I parse the list as string then split it. However, I can't imagine that in 2019 there is no better way to do this.     </p>
  
  <p>The workaround:</p>
  
  <pre><code>Scenario Outline: Some scenarion
      Given a list of integer: "&lt;integer_list&gt;" 
  
      Examples:
        | integer_list   |
        | 2, 3, 5, 6     | 
        | 3, 12, 45, 5, 6| 
  
  
  @Given("a list of integer: {string}")
      public void storeIntegerList(String integers) {
          List&lt;String&gt; integersAsString = Arrays.asList(integers.split(","));
          List&lt;Integer&gt; integerList = integersAsString.stream().map(s -&gt; Integer.valueOf(s.trim())).collect(Collectors.toList());
          System.out.println(integerList.size());        
      }
  
  </code></pre>