MartinKanters commented on a change in pull request #342:
URL: https://github.com/apache/maven/pull/342#discussion_r429748772
##########
File path: maven-core/src/main/java/org/apache/maven/DefaultMaven.java
##########
@@ -366,20 +366,21 @@ private void afterSessionEnd( Collection<MavenProject>
projects, MavenSession se
private void saveResumptionDataWhenApplicable( MavenExecutionResult
result, MavenSession session )
{
- List<LifecycleExecutionException> lifecycleExecutionExceptions =
result.getExceptions().stream()
+ long lifecycleExecutionExceptionCount = result.getExceptions().stream()
.filter( LifecycleExecutionException.class::isInstance )
- .map( LifecycleExecutionException.class::cast )
- .collect( Collectors.toList() );
+ .count();
Review comment:
We think this is the most readable way of counting those specific
exceptions. Rewriting it in a for-loop could potentially save some resources
(if javac does not already optimize the stream for us). We usually go for
easy-to-read code first, and optimize when needed.
That said, I am not sure if the Maven codebase has a different strategy?
Maybe @rfscholte or someone else can chip in?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]