title: Search in file and then put the results in one List
body: <p>I have a text file that contains value like this:</p>
  
  <pre><code>name1, value1, number 1,
  name2, value2, number 2,
  </code></pre>
  
  <p>I search in this file with the first value (let say name2) and I want to put in the list value2 and number2. How can I do this? For the first value I did it but I don't know how to do to store all the date from that line..</p>
  
  <pre><code>  public static List&lt;String&gt; findLocalityValues(String path, String word) throws FileNotFoundException {
      Scanner scanner = new Scanner(new File(path)).useDelimiter(word + ",");
  
      List&lt;String&gt; list = new ArrayList&lt;String&gt;();
      while (scanner.hasNext()) {
        String found = scanner.next();
        list.add(found.substring(0, found.indexOf(',')));
  
      }
      return list;
    }
  </code></pre>