From 96a7f1f00ebb07b98a73ace5a35d2c245265c295 Mon Sep 17 00:00:00 2001 From: Eugene Fischer Date: Wed, 17 Jun 2020 17:43:12 -0500 Subject: [PATCH] making all the words lowercase --- Sorting/RandomWordFileReader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sorting/RandomWordFileReader.java b/Sorting/RandomWordFileReader.java index 85a8297..a04c02c 100644 --- a/Sorting/RandomWordFileReader.java +++ b/Sorting/RandomWordFileReader.java @@ -14,7 +14,7 @@ public class RandomWordFileReader { public RandomWordFileReader(String filename){ try(BufferedReader reader = Files.newBufferedReader(Path.of(filename));){ //This should use flatMap to make a string array from the line, and then turn the elements of that array into a stream, which goes to forEach - reader.lines().flatMap(line -> Arrays.stream(line.split("\\s+"))).forEach(word -> words.add(word)); + reader.lines().flatMap(line -> Arrays.stream(line.split("\\s+"))).forEach(word -> words.add(word.toLowerCase())); }catch (IOException ex){ System.err.println(ex); }