vcs: LinkedList -> ArrayList

GitOrigin-RevId: b41af3c50d10461525f044a40fe599bfc467c9f3
This commit is contained in:
Aleksey Pivovarov
2019-06-25 18:09:55 +03:00
committed by intellij-monorepo-bot
parent e32c1f30d0
commit c62efbfcb7
14 changed files with 33 additions and 37 deletions

View File

@@ -12,7 +12,6 @@ import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class PathMerger {
@@ -161,7 +160,7 @@ public class PathMerger {
public IoFilePathMerger(final File base) {
myBase = base;
myChildPathElements = new LinkedList<>();
myChildPathElements = new ArrayList<>();
}
@Override

View File

@@ -613,7 +613,7 @@ public class PathsVerifier {
myProject = project;
myOverrideExisting = new HashMap<>();
mySkipDeleted = new HashMap<>();
myOverridenPaths = new LinkedList<>();
myOverridenPaths = new ArrayList<>();
}
public void addSkip(final FilePath path, final FilePatch filePatch) {
@@ -628,7 +628,7 @@ public class PathsVerifier {
// returns those to be skipped
public Collection<FilePatch> doDelayed() {
final List<FilePatch> result = new LinkedList<>();
final List<FilePatch> result = new ArrayList<>();
if (! myOverrideExisting.isEmpty()) {
final String title = "Overwrite Existing Files";
List<FilePath> files = new ArrayList<>(myOverrideExisting.keySet());

View File

@@ -27,7 +27,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.FilePathByPathComparator;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -46,8 +45,8 @@ public class TriggerAdditionOrDeletion {
private static final Logger LOG = Logger.getInstance(TriggerAdditionOrDeletion.class);
private final VcsFileListenerContextHelper myVcsFileListenerContextHelper;
private MultiMap<VcsRoot, FilePath> myPreparedAddition;
private MultiMap<VcsRoot, FilePath> myPreparedDeletion;
private Map<VcsRoot, List<FilePath>> myPreparedAddition;
private Map<VcsRoot, List<FilePath>> myPreparedDeletion;
public TriggerAdditionOrDeletion(final Project project) {
myProject = project;
@@ -81,34 +80,34 @@ public class TriggerAdditionOrDeletion {
public void processIt() {
if (myPreparedDeletion != null) {
for (Map.Entry<VcsRoot, Collection<FilePath>> entry : myPreparedDeletion.entrySet()) {
for (Map.Entry<VcsRoot, List<FilePath>> entry : myPreparedDeletion.entrySet()) {
final VcsRoot vcsRoot = entry.getKey();
final AbstractVcs vcs = ObjectUtils.assertNotNull(vcsRoot.getVcs());
final CheckinEnvironment localChangesProvider = vcs.getCheckinEnvironment();
if (localChangesProvider == null) continue;
final Collection<FilePath> filePaths = entry.getValue();
final List<FilePath> filePaths = entry.getValue();
if (vcs.fileListenerIsSynchronous()) {
myAffected.addAll(filePaths);
continue;
}
askUserIfNeeded(vcsRoot.getVcs(), (List<FilePath>)filePaths, VcsConfiguration.StandardConfirmation.REMOVE);
askUserIfNeeded(vcsRoot.getVcs(), filePaths, VcsConfiguration.StandardConfirmation.REMOVE);
myAffected.addAll(filePaths);
localChangesProvider.scheduleMissingFileForDeletion((List<FilePath>)filePaths);
localChangesProvider.scheduleMissingFileForDeletion(filePaths);
}
}
if (myPreparedAddition != null) {
final List<FilePath> incorrectFilePath = new ArrayList<>();
for (Map.Entry<VcsRoot, Collection<FilePath>> entry : myPreparedAddition.entrySet()) {
for (Map.Entry<VcsRoot, List<FilePath>> entry : myPreparedAddition.entrySet()) {
final VcsRoot vcsRoot = entry.getKey();
final AbstractVcs vcs = ObjectUtils.assertNotNull(vcsRoot.getVcs());
final CheckinEnvironment localChangesProvider = vcs.getCheckinEnvironment();
if (localChangesProvider == null) continue;
final Collection<FilePath> filePaths = entry.getValue();
final List<FilePath> filePaths = entry.getValue();
if (vcs.fileListenerIsSynchronous()) {
myAffected.addAll(filePaths);
continue;
}
askUserIfNeeded(vcsRoot.getVcs(), (List<FilePath>)filePaths, VcsConfiguration.StandardConfirmation.ADD);
askUserIfNeeded(vcsRoot.getVcs(), filePaths, VcsConfiguration.StandardConfirmation.ADD);
myAffected.addAll(filePaths);
final List<VirtualFile> virtualFiles = new ArrayList<>();
ContainerUtil.process(filePaths, path -> {
@@ -145,7 +144,7 @@ public class TriggerAdditionOrDeletion {
private void processDeletion() {
Map<VcsRoot, List<FilePath>> map = groupByRoots(myProject, myDeleted, identity());
myPreparedDeletion = new MultiMap<>();
myPreparedDeletion = new HashMap<>();
for (VcsRoot vcsRoot : map.keySet()) {
if (vcsRoot != null && vcsRoot.getVcs() != null) {
final CheckinEnvironment localChangesProvider = vcsRoot.getVcs().getCheckinEnvironment();
@@ -153,7 +152,7 @@ public class TriggerAdditionOrDeletion {
final boolean takeDirs = vcsRoot.getVcs().areDirectoriesVersionedItems();
final Collection<FilePath> files = map.get(vcsRoot);
final List<FilePath> toBeDeleted = new LinkedList<>();
final List<FilePath> toBeDeleted = new ArrayList<>();
for (FilePath file : files) {
final FilePath parent = file.getParentPath();
if ((takeDirs || (! file.isDirectory())) && parent != null && parent.getIOFile().exists()) {
@@ -174,7 +173,7 @@ public class TriggerAdditionOrDeletion {
private void processAddition() {
Map<VcsRoot, List<FilePath>> map = groupByRoots(myProject, myExisting, identity());
myPreparedAddition = new MultiMap<>();
myPreparedAddition = new HashMap<>();
for (VcsRoot vcsRoot : map.keySet()) {
if (vcsRoot != null && vcsRoot.getVcs() != null) {
final CheckinEnvironment localChangesProvider = vcsRoot.getVcs().getCheckinEnvironment();
@@ -190,7 +189,7 @@ public class TriggerAdditionOrDeletion {
}
toBeAdded = adder.getToBeAdded();
} else {
toBeAdded = new LinkedList<>();
toBeAdded = new ArrayList<>();
for (FilePath file : files) {
if (! file.isDirectory()) {
toBeAdded.add(file);

View File

@@ -417,7 +417,7 @@ public abstract class VcsVFSListener implements Disposable {
}
}
else {
final List<VirtualFile> list = new LinkedList<>();
final List<VirtualFile> list = new ArrayList<>();
VcsUtil.collectFiles(file, list, true, isDirectoryVersioningSupported());
for (VirtualFile child : list) {
if (!myChangeListManager.isIgnoredFile(child)) {

View File

@@ -17,7 +17,7 @@ public class DescindingFilesFilter {
@NotNull
public static FilePath[] filterDescindingFiles(@NotNull FilePath[] roots, Project project) {
final List<FilePath> result = new LinkedList<>();
final List<FilePath> result = new ArrayList<>();
ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
Arrays.sort(roots, FilePathComparator.getInstance());
@@ -34,7 +34,7 @@ public class DescindingFilesFilter {
final List<FilePath> chain = chains.get(vcs.getKeyInstanceMethod());
if (chain == null) {
final LinkedList<FilePath> newList = new LinkedList<>();
final List<FilePath> newList = new ArrayList<>();
newList.add(root);
chains.put(vcs.getKeyInstanceMethod(), newList);
} else {

View File

@@ -99,7 +99,7 @@ public class LazyRefreshingSelfQueue<T> {
// do not ask under lock
final Boolean shouldUpdateOld = onlyAbsolute ? false : myShouldUpdateOldChecker.compute();
final List<T> dirty = new LinkedList<>();
final List<T> dirty = new ArrayList<>();
synchronized (myLock) {
// adds all pairs with pair.First == null to dirty

View File

@@ -17,9 +17,9 @@ import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.messages.Topic;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
public class RemoteRevisionsCache implements VcsListener {
@@ -142,8 +142,8 @@ public class RemoteRevisionsCache implements VcsListener {
synchronized (myLock) {
strategyMap = new HashMap<>(myKinds);
}
final Collection<String> newForTree = new LinkedList<>();
final Collection<String> newForUsual = new LinkedList<>();
final Collection<String> newForTree = new ArrayList<>();
final Collection<String> newForUsual = new ArrayList<>();
UpdateFilesHelper.iterateAffectedFiles(updatedFiles, pair -> {
final String vcsName = pair.getSecond();
RemoteDifferenceStrategy strategy = strategyMap.get(vcsName);

View File

@@ -36,7 +36,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -383,7 +382,7 @@ public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvide
public void passCachedListsToListener(final VcsConfigurationChangeListener.DetailedNotification notification,
final Project project, final VirtualFile root) {
final LinkedList<CommittedChangeList> resultList = new LinkedList<>();
final List<CommittedChangeList> resultList = new ArrayList<>();
myBrowser.reportLoadedLists(new CommittedChangeListsListener() {
@Override
public void onBeforeStartReport() {

View File

@@ -50,7 +50,7 @@ public class ApplyPatchDefaultExecutor implements ApplyPatchExecutor<AbstractFil
protected Collection<PatchApplier> getPatchAppliers(@NotNull MultiMap<VirtualFile, AbstractFilePatchInProgress> patchGroups,
@Nullable LocalChangeList localList,
@NotNull CommitContext commitContext) {
final Collection<PatchApplier> appliers = new LinkedList<>();
final Collection<PatchApplier> appliers = new ArrayList<>();
for (VirtualFile base : patchGroups.keySet()) {
appliers.add(new PatchApplier<BinaryFilePatch>(myProject, base,
ContainerUtil

View File

@@ -143,7 +143,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
descriptor.setTitle(VcsBundle.message("patch.apply.select.title"));
myProject = project;
myPatches = new LinkedList<>();
myPatches = new ArrayList<>();
myRecentPathFileChange = new AtomicReference<>();
myBinaryShelvedPatches = binaryShelvedPatches;
myPreselectedChanges = preselectedChanges;
@@ -730,7 +730,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
final NamedLegendStatuses totalNameStatuses = new NamedLegendStatuses();
final NamedLegendStatuses includedNameStatuses = new NamedLegendStatuses();
final Collection<AbstractFilePatchInProgress.PatchChange> included = new LinkedList<>();
final Collection<AbstractFilePatchInProgress.PatchChange> included = new ArrayList<>();
if (doInitCheck) {
for (AbstractFilePatchInProgress.PatchChange change : changes) {
acceptChange(totalNameStatuses, change);

View File

@@ -23,7 +23,6 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@@ -77,7 +76,7 @@ public class ChangesViewContentManager implements ChangesViewContentI, Disposabl
}
private void loadExtensionTabs() {
final List<Content> contentList = new LinkedList<>();
final List<Content> contentList = new ArrayList<>();
for(ChangesViewContentEP ep: ChangesViewContentEP.EP_NAME.getExtensionList(myProject)) {
final NotNullFunction<Project,Boolean> predicate = ep.newPredicateInstance(myProject);
if (predicate == null || predicate.fun(myProject).equals(Boolean.TRUE)) {

View File

@@ -695,7 +695,7 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
myLocation = location;
mySettings = settings;
myDlg = dlg;
myExceptions = new LinkedList<>();
myExceptions = new ArrayList<>();
}
public void cancel() {

View File

@@ -78,7 +78,7 @@ public class VcsRootIterator {
myRoot = root;
myVcsName = vcsName;
myExcludedByOthers = new LinkedList<>();
myExcludedByOthers = new ArrayList<>();
}
private void init(final VcsRoot[] allRoots) {

View File

@@ -32,10 +32,10 @@ public class FileWatchRequestModifier implements Runnable {
if (!myProject.isInitialized() || myProject.isDisposed()) return;
final List<VcsDirectoryMapping> copy = myNewMappings.getDirectoryMappings();
final List<VcsDirectoryMapping> added = new LinkedList<>(copy);
final List<VcsDirectoryMapping> added = new ArrayList<>(copy);
added.removeAll(myDirectoryMappingWatches.keySet());
final List<VcsDirectoryMapping> deleted = new LinkedList<>(myDirectoryMappingWatches.keySet());
final List<VcsDirectoryMapping> deleted = new ArrayList<>(myDirectoryMappingWatches.keySet());
deleted.removeAll(copy);
final Map<String, VcsDirectoryMapping> toAdd = ContainerUtil.newTroveMap(FileUtil.PATH_HASHING_STRATEGY);
@@ -45,7 +45,7 @@ public class FileWatchRequestModifier implements Runnable {
}
}
final Collection<LocalFileSystem.WatchRequest> toRemove = new LinkedList<>();
final Collection<LocalFileSystem.WatchRequest> toRemove = new ArrayList<>();
for (VcsDirectoryMapping mapping : deleted) {
if (mapping.isDefaultMapping()) continue;
final LocalFileSystem.WatchRequest removed = myDirectoryMappingWatches.remove(mapping);