Q:

How do I make an array of only Strings from a txt file with Strings and doubles?

Heres the txt file: http://txt.do/5w3em
I just need the Strings (EXCLUDING THE COMMENTED OUT ONES), the M's and B's, all on separate lines from the text file and none of the doubles. How do I make an array list to store them all?
I tried this
List<String> trainingDatasetStrings = new ArrayList<String>();
    while(inFile.hasNextLine()){
        String line = inFile.nextLine();
        String[] words = line.split(",");
        for(int i = 11; i < words.length; i++)
        trainingDatasetStrings.add(words[i]);
    }

But it wont help.

A:

Try this.
    List<String> result = Files.readAllLines(Paths.get(fileName)).stream()
        .filter(s -> !s.startsWith("//"))
        .flatMap(s -> Stream.of(s.split(",")))
        .filter(s -> !s.matches("\\d+(\\.\\d*)?"))
        .collect(Collectors.toList());
    System.out.println(result);

