Skip to content

Commit

Permalink
Change_in_code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroslav Narozhnyi committed Dec 23, 2024
1 parent e9fa9a2 commit f8c05cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/practice/CandidateValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ public class CandidateValidator implements Predicate<Candidate> {
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)
Expand Down
1 change: 0 additions & 1 deletion src/main/java/practice/StreamPractice.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public int findMinEvenNumber(List<String> numbers) {
* But before that subtract 1 from each element on an odd position (having the odd index).
*/
public Double getOddNumsAverage(List<Integer> 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)
Expand Down

0 comments on commit f8c05cd

Please sign in to comment.