Skip to content

Commit

Permalink
Avoid copying an already immutable list
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Oct 11, 2019
1 parent 2224adc commit 539a4d7
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -93,7 +93,7 @@ public LocalComponentDependencyMetadata(ComponentIdentifier componentId,
}

private static List<IvyArtifactName> asImmutable(List<IvyArtifactName> artifactNames) {
return artifactNames.isEmpty() ? Collections.emptyList() : ImmutableList.copyOf(artifactNames);
return artifactNames.isEmpty() ? Collections.emptyList() : artifactNames instanceof ImmutableList ? artifactNames : ImmutableList.copyOf(artifactNames);
}

@Override
Expand Down

0 comments on commit 539a4d7

Please sign in to comment.