Skip to content

Commit

Permalink
Delete comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rmiccoli committed Jun 19, 2024
1 parent 2d8f5f1 commit 4d377ec
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,15 @@ public boolean isValid(String value, ConstraintValidatorContext context) {
}

try {
// Split the string by commas and convert to a list of integers
List<Integer> numbers = Arrays.stream(value.split(","))
.map(String::trim)
.map(Integer::parseInt)
.collect(Collectors.toList());

// Check that all integers are greater than 0
if (numbers.stream().anyMatch(i -> i <= 0)) {
return false;
}

// Check for duplicates by comparing sizes
Set<Integer> uniqueNumbers = new HashSet<>(numbers);
return uniqueNumbers.size() == numbers.size();
} catch (NumberFormatException e) {
Expand Down

0 comments on commit 4d377ec

Please sign in to comment.