2424import java .util .List ;
2525import java .util .Optional ;
2626import java .util .concurrent .atomic .AtomicInteger ;
27- import java .util .stream .Collectors ;
2827
2928import groovy .lang .Tuple2 ;
3029import nextflow .script .ast .AssignmentExpression ;
@@ -348,7 +347,7 @@ private IncludeNode includeDeclaration(IncludeDeclarationContext ctx) {
348347 result .putNodeMetaData ("_START_ALIAS" , tokenPosition (it .alias ));
349348 return ast ( result , it );
350349 })
351- .collect ( Collectors . toList () );
350+ .toList ();
352351
353352 return ast ( new IncludeNode (source , modules ), ctx );
354353 }
@@ -401,7 +400,7 @@ private Statement processDirectives(ProcessDirectivesContext ctx) {
401400 var statements = ctx .statement ().stream ()
402401 .map (this ::statement )
403402 .map (stmt -> checkDirective (stmt , "Invalid process directive" ))
404- .collect ( Collectors . toList () );
403+ .toList ();
405404 return ast ( block (null , statements ), ctx );
406405 }
407406
@@ -411,7 +410,7 @@ private Statement processInputs(ProcessInputsContext ctx) {
411410 var statements = ctx .statement ().stream ()
412411 .map (this ::statement )
413412 .map (stmt -> checkDirective (stmt , "Invalid process input" ))
414- .collect ( Collectors . toList () );
413+ .toList ();
415414 return ast ( block (null , statements ), ctx );
416415 }
417416
@@ -421,7 +420,7 @@ private Statement processOutputs(ProcessOutputsContext ctx) {
421420 var statements = ctx .statement ().stream ()
422421 .map (this ::statement )
423422 .map (stmt -> checkDirective (stmt , "Invalid process output" ))
424- .collect ( Collectors . toList () );
423+ .toList ();
425424 return ast ( block (null , statements ), ctx );
426425 }
427426
@@ -543,7 +542,7 @@ private Statement workflowTakes(WorkflowTakesContext ctx) {
543542
544543 var statements = ctx .identifier ().stream ()
545544 .map (this ::workflowTake )
546- .collect ( Collectors . toList () );
545+ .toList ();
547546 return ast ( block (null , statements ), ctx );
548547 }
549548
@@ -560,7 +559,7 @@ private Statement workflowEmits(WorkflowEmitsContext ctx) {
560559 var statements = ctx .statement ().stream ()
561560 .map (this ::workflowEmit )
562561 .filter (stmt -> stmt != null )
563- .collect ( Collectors . toList () );
562+ .toList ();
564563 var result = ast ( block (null , statements ), ctx );
565564 var hasEmitExpression = statements .stream ().anyMatch (this ::isEmitExpression );
566565 if ( hasEmitExpression && statements .size () > 1 )
@@ -594,7 +593,7 @@ private Statement workflowPublishers(WorkflowPublishersContext ctx) {
594593 .map (this ::statement )
595594 .map (this ::checkWorkflowPublisher )
596595 .filter (stmt -> stmt != null )
597- .collect ( Collectors . toList () );
596+ .toList ();
598597 return ast ( block (null , statements ), ctx );
599598 }
600599
@@ -619,7 +618,7 @@ private Statement outputBody(OutputBodyContext ctx) {
619618 return EmptyStatement .INSTANCE ;
620619 var statements = ctx .outputTargetBody ().stream ()
621620 .map (this ::outputTargetBody )
622- .collect ( Collectors . toList () );
621+ .toList ();
623622 return ast ( block (null , statements ), ctx );
624623 }
625624
@@ -716,15 +715,15 @@ private BlockStatement blockStatements(BlockStatementsContext ctx) {
716715 return block (new VariableScope (), Collections .emptyList ());
717716 var statements = ctx .statement ().stream ()
718717 .map (this ::statement )
719- .collect ( Collectors . toList () );
718+ .toList ();
720719 return ast ( block (new VariableScope (), statements ), ctx );
721720 }
722721
723722 private Statement tryCatchStatement (TryCatchStatementContext ctx ) {
724723 var tryStatement = statementOrBlock (ctx .statementOrBlock ());
725724 var catchClauses = ctx .catchClause ().stream ()
726725 .map (this ::catchClause )
727- .collect ( Collectors . toList () );
726+ .toList ();
728727 var result = tryCatchS (tryStatement );
729728 for ( var clause : catchClauses )
730729 for ( var stmt : clause )
@@ -742,7 +741,7 @@ private List<CatchStatement> catchClause(CatchClauseContext ctx) {
742741 var code = statementOrBlock (ctx .statementOrBlock ());
743742 return ast ( new CatchStatement (variable , code ), ctx );
744743 })
745- .collect ( Collectors . toList () );
744+ .toList ();
746745 }
747746
748747 private List <ClassNode > catchTypes (CatchTypesContext ctx ) {
@@ -751,7 +750,7 @@ private List<ClassNode> catchTypes(CatchTypesContext ctx) {
751750
752751 return ctx .qualifiedClassName ().stream ()
753752 .map (this ::qualifiedClassName )
754- .collect ( Collectors . toList () );
753+ .toList ();
755754 }
756755
757756 private Statement returnStatement (ExpressionContext ctx ) {
@@ -780,7 +779,7 @@ private Statement variableDeclaration(VariableDeclarationContext ctx) {
780779 // multiple assignment
781780 var variables = ctx .variableNames ().identifier ().stream ()
782781 .map (ident -> (Expression ) variableName (ident ))
783- .collect ( Collectors . toList () );
782+ .toList ();
784783 var target = new ArgumentListExpression (variables );
785784 var initializer = expression (ctx .initializer );
786785 return stmt (ast ( declX (target , initializer ), ctx ));
@@ -799,7 +798,7 @@ private Statement variableDeclaration(VariableDeclarationContext ctx) {
799798 private Expression variableNames (VariableNamesContext ctx ) {
800799 var vars = ctx .identifier ().stream ()
801800 .map (this ::variableName )
802- .collect ( Collectors . toList () );
801+ .toList ();
803802 return ast ( new TupleExpression (vars ), ctx );
804803 }
805804
@@ -1365,7 +1364,7 @@ private Expression closureWithLabels(ClosureWithLabelsContext ctx) {
13651364 private BlockStatement blockStatementsWithLabels (BlockStatementsWithLabelsContext ctx ) {
13661365 var statements = ctx .statementOrLabeled ().stream ()
13671366 .map (this ::statementOrLabeled )
1368- .collect ( Collectors . toList () );
1367+ .toList ();
13691368 return ast ( block (new VariableScope (), statements ), ctx );
13701369 }
13711370
@@ -1397,7 +1396,7 @@ private List<Expression> expressionList(ExpressionListContext ctx) {
13971396
13981397 return ctx .expression ().stream ()
13991398 .map (this ::expression )
1400- .collect ( Collectors . toList () );
1399+ .toList ();
14011400 }
14021401
14031402 private Expression map (MapContext ctx ) {
@@ -1406,7 +1405,7 @@ private Expression map(MapContext ctx) {
14061405
14071406 var entries = ctx .mapEntryList ().mapEntry ().stream ()
14081407 .map (this ::mapEntry )
1409- .collect ( Collectors . toList () );
1408+ .toList ();
14101409 var result = mapX (entries );
14111410 if ( ctx .COMMA () != null )
14121411 result .putNodeMetaData (TRAILING_COMMA , Boolean .TRUE );
@@ -1537,7 +1536,7 @@ private Parameter[] formalParameterList(FormalParameterListContext ctx) {
15371536
15381537 var params = ctx .formalParameter ().stream ()
15391538 .map (this ::formalParameter )
1540- .collect ( Collectors . toList () );
1539+ .toList ();
15411540 for ( int n = params .size (), i = n - 1 ; i >= 0 ; i -= 1 ) {
15421541 var param = params .get (i );
15431542 for ( var other : params ) {
0 commit comments