Cleaned up code for some packages (#5094)

* Cleaned up code of some packages

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
Kanivets Kateryna
2024-04-02 21:26:06 +02:00
committed by GitHub
parent 40cd4d86ef
commit 22310defcd
12 changed files with 23 additions and 29 deletions

View File

@ -25,12 +25,11 @@ public class Pangram {
*/
// alternative approach using Java Collection Framework
public static boolean isPangramUsingSet(String s) {
HashSet<Character> alpha = new HashSet<Character>();
HashSet<Character> alpha = new HashSet<>();
s = s.trim().toLowerCase();
for (int i = 0; i < s.length(); i++)
if (s.charAt(i) != ' ') alpha.add(s.charAt(i));
if (alpha.size() == 26) return true;
return false;
return alpha.size() == 26;
}
/**