Skip to content

Commit

Permalink
implemented minor code suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wittler committed Aug 3, 2022
1 parent 8b2b9cc commit 6d705b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions jplag/src/main/java/de/jplag/JPlagComparison.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof JPlagComparison)) {
if (!(other instanceof JPlagComparison otherComparison)) {
return false;
}
JPlagComparison otherComparison = (JPlagComparison) other;
return firstSubmission.equals(otherComparison.getFirstSubmission()) && secondSubmission.equals(otherComparison.getSecondSubmission())
&& matches.equals(otherComparison.matches);
}
Expand Down
5 changes: 3 additions & 2 deletions jplag/src/main/java/de/jplag/Submission.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ public int compareTo(Submission other) {
public boolean equals(Object obj) {
if (obj == this) {
return true;
} else if (!(obj instanceof Submission)) {
}
if (!(obj instanceof Submission otherSubmission)) {
return false;
}
return ((Submission) obj).getName().equals(name);
return otherSubmission.getName().equals(name);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion jplag/src/main/java/de/jplag/SubmissionSetBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private Optional<Submission> loadBaseCode(Set<File> submissionDirectories, Set<F
logger.info("Submission \"{}\" is the specified basecode, it will be skipped during comparison.", removed.getName());
}
}
return Optional.of(baseCode);
return Optional.ofNullable(baseCode);
}

/**
Expand Down

0 comments on commit 6d705b9

Please sign in to comment.