diff --git a/simple-algorithms/longest-substring/build.gradle b/simple-algorithms/longest-substring/build.gradle index e81e635..e2b9b60 100644 --- a/simple-algorithms/longest-substring/build.gradle +++ b/simple-algorithms/longest-substring/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' } -def junitVersion = '5.9.3' +def junitVersion = '5.10.2' group 'com.josdem.kata' version '1.0-SNAPSHOT' diff --git a/simple-algorithms/longest-substring/src/main/java/com/josdem/kata/LongestSubstring.java b/simple-algorithms/longest-substring/src/main/java/com/josdem/kata/LongestSubstring.java index 0645614..5881066 100644 --- a/simple-algorithms/longest-substring/src/main/java/com/josdem/kata/LongestSubstring.java +++ b/simple-algorithms/longest-substring/src/main/java/com/josdem/kata/LongestSubstring.java @@ -7,6 +7,6 @@ public class LongestSubstring { public int reduce(String data) { List substrings = Arrays.stream(data.split("")).distinct().toList(); - return substrings.size() > 0 ? substrings.size() : 1; + return !substrings.isEmpty() ? substrings.size() : 1; } }