Skip to content

Commit

Permalink
Simplify stream expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 17, 2024
1 parent 0f3662f commit ab79086
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/hudson/plugins/ec2/SlaveTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -2203,7 +2203,8 @@ private DescribeImagesRequest makeDescribeImagesRequest() throws AmazonClientExc
// Raise an exception if there were no search attributes.
// This is legal but not what anyone wants - it will
// launch random recently created public AMIs.
int numAttrs = Stream.of(imageIds, owners, users, filters).collect(Collectors.summingInt(List::size));
int numAttrs =
Stream.of(imageIds, owners, users, filters).mapToInt(List::size).sum();
if (numAttrs == 0) {
throw new AmazonClientException("Neither AMI ID nor AMI search attributes provided");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.stream.Collectors;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
Expand All @@ -55,11 +54,11 @@ public String getDisplayName() {
}

public String getVeryInsecureTemplates() {
return veryInsecureTemplates.stream().collect(Collectors.joining(", "));
return String.join(", ", veryInsecureTemplates);
}

public String getInsecureTemplates() {
return insecureTemplates.stream().collect(Collectors.joining(", "));
return String.join(", ", insecureTemplates);
}

public boolean showVeryInsecureTemplates() {
Expand Down

0 comments on commit ab79086

Please sign in to comment.