Some LinkedLists removed

GitOrigin-RevId: 09f10c0fd533988f1c25148a128036b5bf1f581e
This commit is contained in:
Tagir Valeev
2023-02-01 09:54:36 +00:00
committed by intellij-monorepo-bot
parent fc1a9c0ea8
commit 0dfd299f9b
5 changed files with 16 additions and 29 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.service.project;
import com.intellij.build.events.MessageEvent;
@@ -548,7 +548,7 @@ public final class GradleProjectResolverUtil {
@Nullable DataNode<ProjectData> ideProject) throws IllegalStateException {
Map<ExternalDependencyId, ExternalDependency> dependencyMap = new HashMap<>();
Queue<ExternalDependency> queue = new LinkedList<>(dependencies);
Queue<ExternalDependency> queue = new ArrayDeque<>(dependencies);
while (!queue.isEmpty()) {
final ExternalDependency dependency = queue.remove();
DefaultExternalDependencyId key = new DefaultExternalDependencyId(dependency.getId());
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.service.project;
import com.intellij.openapi.externalSystem.model.DataNode;
@@ -72,7 +72,7 @@ public class LibraryDataNodeSubstitutor {
boolean shouldKeepTransitiveDependencies = libraryPaths.size() > 0 && !libraryDependencyDataNode.getChildren().isEmpty();
final LinkedList<String> unprocessedPaths = new LinkedList<>(libraryPaths);
final ArrayDeque<String> unprocessedPaths = new ArrayDeque<>(libraryPaths);
while (!unprocessedPaths.isEmpty()) {
final String path = unprocessedPaths.remove();
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.model;
import com.intellij.openapi.externalSystem.model.ExternalSystemException;
@@ -226,7 +226,7 @@ public class ProjectImportAction implements BuildAction<ProjectImportAction.AllM
Set<GradleBuild> nestedBuilds = new LinkedHashSet<GradleBuild>();
String rootBuildPath = rootBuild.getBuildIdentifier().getRootDir().getPath();
processedBuildsPaths.add(rootBuildPath);
Queue<GradleBuild> queue = new LinkedList<GradleBuild>(rootBuild.getIncludedBuilds());
Queue<GradleBuild> queue = new ArrayDeque<>(rootBuild.getIncludedBuilds());
while (!queue.isEmpty()) {
GradleBuild includedBuild = queue.remove();
String includedBuildPath = includedBuild.getBuildIdentifier().getRootDir().getPath();
@@ -1,6 +1,7 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.model;
import org.gradle.internal.impldep.com.google.common.base.Objects;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.DefaultExternalDependencyId;
@@ -8,7 +9,7 @@ import org.jetbrains.plugins.gradle.ExternalDependencyId;
import org.jetbrains.plugins.gradle.tooling.util.BiFunction;
import org.jetbrains.plugins.gradle.tooling.util.BooleanBiFunction;
import org.jetbrains.plugins.gradle.tooling.util.GradleContainerUtil;
import org.gradle.internal.impldep.com.google.common.base.Objects;
import java.io.File;
import java.util.*;
@@ -185,13 +186,13 @@ public abstract class AbstractExternalDependency implements ExternalDependency {
private static final class DependenciesIterator implements Iterator<AbstractExternalDependency> {
private final Set<AbstractExternalDependency> mySeenDependencies;
private final LinkedList<ExternalDependency> myToProcess;
private final LinkedList<Integer> myProcessedStructure;
private final ArrayDeque<ExternalDependency> myToProcess;
private final ArrayList<Integer> myProcessedStructure;
private DependenciesIterator(@NotNull Collection<ExternalDependency> dependencies) {
mySeenDependencies = Collections.newSetFromMap(new IdentityHashMap<AbstractExternalDependency, Boolean>());
myToProcess = new LinkedList<ExternalDependency>(dependencies);
myProcessedStructure = new LinkedList<Integer>();
myToProcess = new ArrayDeque<>(dependencies);
myProcessedStructure = new ArrayList<Integer>();
}
@Override
@@ -1,25 +1,11 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.gradle.tooling.util;
import org.jetbrains.plugins.gradle.model.ExternalDependency;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
/**
@@ -41,7 +27,7 @@ public class DependencyTraverser implements Iterable<ExternalDependency> {
Queue<ExternalDependency> queue;
Itr(Collection<ExternalDependency> c) {
queue = new LinkedList<ExternalDependency>(c);
queue = new ArrayDeque<>(c);
}
@Override