mirror of https://github.com/apache/maven.git
[MNG-6492] - Minor improvement on Array construction, conversion performance
This commit is contained in:
parent
e4b53d3f2c
commit
ba74b96633
|
@ -313,12 +313,8 @@ public final class ModelUtils
|
|||
|
||||
public static List<Repository> mergeRepositoryLists( List<Repository> dominant, List<Repository> recessive )
|
||||
{
|
||||
List<Repository> repositories = new ArrayList<>();
|
||||
|
||||
for ( Repository repository : dominant )
|
||||
{
|
||||
repositories.add( repository );
|
||||
}
|
||||
List<Repository> repositories = new ArrayList<>( dominant );
|
||||
|
||||
for ( Repository repository : recessive )
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ public class DefaultClasspathTransformation
|
|||
|
||||
if ( exits != null && exits.size() > 0 )
|
||||
{
|
||||
MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[exits.size()] );
|
||||
MetadataGraphEdge[] sortedExits = exits.toArray( new MetadataGraphEdge[0] );
|
||||
Arrays.sort( sortedExits
|
||||
,
|
||||
new Comparator<MetadataGraphEdge>()
|
||||
|
|
|
@ -49,6 +49,7 @@ import org.eclipse.aether.resolution.VersionRangeRequest;
|
|||
import org.eclipse.aether.resolution.VersionRangeResolutionException;
|
||||
import org.eclipse.aether.resolution.VersionRangeResult;
|
||||
|
||||
|
||||
/**
|
||||
* A model resolver to assist building of projects. This resolver gives priority to those repositories that have been
|
||||
* declared in the POM.
|
||||
|
@ -91,9 +92,7 @@ public class ProjectModelResolver
|
|||
this.resolver = resolver;
|
||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.pomRepositories = new ArrayList<>();
|
||||
List<RemoteRepository> externalRepositories = new ArrayList<>();
|
||||
externalRepositories.addAll( repositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||
this.repositories = new ArrayList<>();
|
||||
this.repositories.addAll( externalRepositories );
|
||||
this.repositoryMerging = repositoryMerging;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class DefaultToolchainManagerPrivate
|
|||
}
|
||||
}
|
||||
|
||||
return toRet.toArray( new ToolchainPrivate[toRet.size()] );
|
||||
return toRet.toArray( new ToolchainPrivate[0] );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,10 +50,7 @@ public class MojoExecutorStub
|
|||
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
|
||||
throws LifecycleExecutionException
|
||||
{
|
||||
for ( MojoExecution mojoExecution : mojoExecutions )
|
||||
{
|
||||
executions.add( mojoExecution );
|
||||
}
|
||||
executions.addAll(mojoExecutions);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ public class CleanArgument
|
|||
}
|
||||
else
|
||||
{
|
||||
cleanArgs = cleaned.toArray( new String[cleanedSz] );
|
||||
cleanArgs = cleaned.toArray( new String[0] );
|
||||
}
|
||||
|
||||
return cleanArgs;
|
||||
|
|
|
@ -384,7 +384,7 @@ public class MavenCli
|
|||
}
|
||||
}
|
||||
|
||||
mavenConfig = cliManager.parse( args.toArray( new String[args.size()] ) );
|
||||
mavenConfig = cliManager.parse( args.toArray( new String[0] ) );
|
||||
List<?> unrecongized = mavenConfig.getArgList();
|
||||
if ( !unrecongized.isEmpty() )
|
||||
{
|
||||
|
@ -1196,7 +1196,7 @@ public class MavenCli
|
|||
sb.append( String.format( "%s\n", configurationProcessor.getClass().getName() ) );
|
||||
}
|
||||
}
|
||||
sb.append( String.format( "\n" ) );
|
||||
sb.append( "\n" );
|
||||
throw new Exception( sb.toString() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,9 +263,8 @@ public class StringSearchModelInterpolator
|
|||
fields.add( new ObjectField( currentField ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
this.fields = fields.toArray( new CacheField[fields.size()] );
|
||||
this.fields = fields.toArray( new CacheField[0] );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -89,9 +89,7 @@ class DefaultModelResolver
|
|||
this.versionRangeResolver = versionRangeResolver;
|
||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.repositories = repositories;
|
||||
List<RemoteRepository> externalRepositories = new ArrayList<>();
|
||||
externalRepositories.addAll( repositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( externalRepositories );
|
||||
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||
|
||||
this.repositoryIds = new HashSet<>();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue