diff --git a/src/main/java/practice/CandidateValidator.java b/src/main/java/practice/CandidateValidator.java index ed5b3d380..3e91f5203 100644 --- a/src/main/java/practice/CandidateValidator.java +++ b/src/main/java/practice/CandidateValidator.java @@ -9,10 +9,11 @@ public class CandidateValidator implements Predicate { private static final int PART_TWO = 1; private static final int TO_AGE = 35; private static final int DURATION_IN_UKRAINE = 10; + private static final String SEPARATOR = "-"; @Override public boolean test(Candidate candidate) { - String[] splitted = candidate.getPeriodsInUkr().split("-"); + String[] splitted = candidate.getPeriodsInUkr().split(SEPARATOR); int duration = Integer.parseInt(splitted[PART_TWO]) - Integer.parseInt(splitted[PART_ONE]); if (candidate.isAllowedToVote() && candidate.getAge() >= TO_AGE && candidate.getNationality().equals(NATIONALITY) diff --git a/src/main/java/practice/StreamPractice.java b/src/main/java/practice/StreamPractice.java index 20830b5e3..e6e0f04c5 100644 --- a/src/main/java/practice/StreamPractice.java +++ b/src/main/java/practice/StreamPractice.java @@ -33,7 +33,6 @@ public int findMinEvenNumber(List numbers) { * But before that subtract 1 from each element on an odd position (having the odd index). */ public Double getOddNumsAverage(List numbers) { - Double sum = (double) 0; return IntStream.range(0, numbers.size()) .map(i -> (i % 2 != 0) ? numbers.get(i) - 1 : numbers.get(i)) .filter(n -> n % 2 != 0)