From 07e875051f03548a2c1c37882f0b968e82089b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=BB=D0=BB=D1=8F=20=D0=9B=D0=B0=D0=B7=D0=B0=D1=80?= =?UTF-8?q?=D0=B5=D0=B2?= <108271589+bagouser123@users.noreply.github.com> Date: Sun, 22 Oct 2023 19:08:23 +0300 Subject: [PATCH] add word starts with only w words --- src/main/java/core/basesyntax/FileWork.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/core/basesyntax/FileWork.java b/src/main/java/core/basesyntax/FileWork.java index a4fea2ca..6934a6d0 100644 --- a/src/main/java/core/basesyntax/FileWork.java +++ b/src/main/java/core/basesyntax/FileWork.java @@ -14,7 +14,7 @@ public String[] readFromFile(String fileName) { StringBuilder content = new StringBuilder(); String line; - while ((line = reader.readLine()) != null){ + while ((line = reader.readLine()) != null) { content.append(line).append(" "); } reader.close(); @@ -25,7 +25,7 @@ public String[] readFromFile(String fileName) { Matcher matcher = pattern.matcher(text); HashSet filteredWords = new HashSet<>(); - while(matcher.find()) { + while (matcher.find()) { String word = matcher.group(); if (word.startsWith("w")) { filteredWords.add(word);