Skip to content

Commit

Permalink
StashRepository: Use sort() method of the List (#178)
Browse files Browse the repository at this point in the history
That's a Java 8 feature. An object can use the best sorting algorithm for
its actual class (ArrayList in this case).
  • Loading branch information
proski authored and jakub-bochenski committed Dec 2, 2019
1 parent d5701c9 commit 7b10a8c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -171,7 +171,7 @@ Map<String, String> getAdditionalParameters(StashPullRequestResponseValue pullRe
client.getPullRequestComments(owner, repositoryName, id);

// Process newest comments last so they can override older comments
Collections.sort(comments);
comments.sort(Comparator.naturalOrder());

Map<String, String> result = new TreeMap<>();

Expand Down Expand Up @@ -594,7 +594,7 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) {
}

// Start with most recent comments
Collections.sort(comments, Collections.reverseOrder());
comments.sort(Comparator.reverseOrder());

for (StashPullRequestComment comment : comments) {
String content = comment.getText();
Expand Down

0 comments on commit 7b10a8c

Please sign in to comment.