From 58e7cb661ac31badc58155792b8fa5cfb0743992 Mon Sep 17 00:00:00 2001 From: irengrig Date: Mon, 8 Nov 2010 13:22:16 +0300 Subject: [PATCH 1/3] git log: - linked list --- .../history/browser/GitTreeController.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/git4idea/src/git4idea/history/browser/GitTreeController.java b/plugins/git4idea/src/git4idea/history/browser/GitTreeController.java index 23cb9c4a49a4..b15eaf8f061f 100644 --- a/plugins/git4idea/src/git4idea/history/browser/GitTreeController.java +++ b/plugins/git4idea/src/git4idea/history/browser/GitTreeController.java @@ -34,6 +34,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Alarm; import com.intellij.util.Consumer; import com.intellij.util.Processor; +import com.intellij.util.SmartList; import com.intellij.util.containers.SLRUCache; import git4idea.GitVcs; import git4idea.changes.GitChangeUtils; @@ -158,8 +159,8 @@ class GitTreeController implements ManageGitTreeView { private void loadCommitsUsingMemoryAndNativeFilters(final Collection startingPoints, final Pair beforePoint, final Date afterPoint, final Collection filters, final int maxCnt) throws VcsException { assert maxCnt > 0; - final List memoryFilters = new LinkedList(); - final List commandFilters = new LinkedList(); + final List memoryFilters = new SmartList(); + final List commandFilters = new SmartList(); for (ChangesFilter.Filter filter : filters) { final ChangesFilter.CommandParametersFilter commandFilter = filter.getCommandParametersFilter(); if (commandFilter == null) { @@ -319,8 +320,8 @@ class GitTreeController implements ManageGitTreeView { } private void loadTagsNBranches() { - final List branches = new LinkedList(); - final List tags = new LinkedList(); + final List branches = new ArrayList(); + final List tags = new ArrayList(); try { myAccess.loadAllBranches(branches); @@ -381,7 +382,7 @@ class GitTreeController implements ManageGitTreeView { myAlarm.addRequest(new Runnable() { public void run() { // start from beginning - final List> wayList = new LinkedList>(); + final List> wayList = new SmartList>(); while (true) { final Pair startFrom = wayList.isEmpty() ? null : wayList.get(wayList.size() - 1); @@ -438,7 +439,7 @@ class GitTreeController implements ManageGitTreeView { final Application application = ApplicationManager.getApplication(); myAlarm.addRequest(new Runnable() { public void run() { - final List loaded = new LinkedList(); + final List loaded = new ArrayList(); final Set requested = new HashSet(hashes.size()); for (SHAHash hash : hashes) { requested.add(GitChangeUtils.longForSHAHash(hash.getValue())); @@ -483,11 +484,11 @@ class GitTreeController implements ManageGitTreeView { } public List getAllBranchesOrdered() { - return new ArrayList(myBranches.get()); + return Collections.unmodifiableList(myBranches.get()); } public List getAllTagsOrdered() { - return new ArrayList(myTags.get()); + return Collections.unmodifiableList(myTags.get()); } public boolean isInitialized() { @@ -566,7 +567,7 @@ class GitTreeController implements ManageGitTreeView { myLock = new Object(); myStartingPoints = new HashSet(); myFilters = new HashSet(); - myContinuationPoints = new LinkedList>(); + myContinuationPoints = new SmartList>(); } public boolean isDirty() { From 47fe060c9262ade4a3afcf439428eae6df372150 Mon Sep 17 00:00:00 2001 From: Kirill Kalishev Date: Mon, 8 Nov 2010 14:51:46 +0300 Subject: [PATCH 2/3] clear client properties for popup on disposal - memleak --- .../src/com/intellij/ui/popup/PopupComponent.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/platform-impl/src/com/intellij/ui/popup/PopupComponent.java b/platform/platform-impl/src/com/intellij/ui/popup/PopupComponent.java index 94b4bbbdee29..aaa7ebeaf936 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/PopupComponent.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/PopupComponent.java @@ -23,6 +23,8 @@ import com.intellij.util.ui.UIUtil; import javax.swing.*; import java.awt.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; public interface PopupComponent { @@ -144,6 +146,14 @@ public interface PopupComponent { public void hide(boolean dispose) { myPopup.hide(); + + Window wnd = getWindow(); + if (wnd instanceof JWindow) { + JRootPane rootPane = ((JWindow)wnd).getRootPane(); + if (rootPane != null) { + ReflectionUtil.resetField(rootPane, "clientProperties"); + } + } } public void show() { From a874564d03ca3d2a85b4837ad7a35dfdb3510f28 Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Mon, 8 Nov 2010 14:56:38 +0300 Subject: [PATCH 3/3] Massive LinkedList->ArrayList migration, using short buffer for string parsed from git log (so we don't retain whole 32K log output holding just branch name). --- .../git4idea/src/git4idea/GitReference.java | 2 +- plugins/git4idea/src/git4idea/GitTag.java | 2 +- plugins/git4idea/src/git4idea/GitUtil.java | 2 +- .../git4idea/actions/GitRepositoryAction.java | 7 ++-- .../src/git4idea/changes/GitChangeUtils.java | 2 +- .../changes/GitOutgoingChangesProvider.java | 2 +- .../src/git4idea/commands/GitHandler.java | 2 +- .../src/git4idea/history/GitLogParser.java | 4 +-- .../src/git4idea/history/GitLogRecord.java | 36 +++++++++++-------- .../git4idea/history/GitUsersComponent.java | 4 +-- .../history/browser/ChangesFilter.java | 6 ++-- .../history/browser/CherryPicker.java | 6 ++-- .../history/browser/GitLogHelper.java | 2 +- .../git4idea/history/browser/GitLogTree.java | 6 ++-- .../history/browser/LowLevelAccessImpl.java | 12 +++---- .../src/git4idea/history/browser/Portion.java | 6 ++-- .../history/wholeTree/LoaderImpl.java | 2 +- .../history/wholeTree/TreeSkeletonImpl.java | 2 +- .../src/git4idea/ui/CurrentBranchDialog.java | 4 +-- .../src/git4idea/vfs/GitIgnoreTracker.java | 7 ++-- .../org/jetbrains/git4idea/ssh/SSHConfig.java | 6 ++-- 21 files changed, 67 insertions(+), 55 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitReference.java b/plugins/git4idea/src/git4idea/GitReference.java index 66b960e655bc..5025d5b23f10 100644 --- a/plugins/git4idea/src/git4idea/GitReference.java +++ b/plugins/git4idea/src/git4idea/GitReference.java @@ -37,7 +37,7 @@ public abstract class GitReference implements Comparable { * @param name the used name */ public GitReference(@NotNull String name) { - myName = name; + myName = new String(name); } /** diff --git a/plugins/git4idea/src/git4idea/GitTag.java b/plugins/git4idea/src/git4idea/GitTag.java index acc607b96661..be875f1af791 100644 --- a/plugins/git4idea/src/git4idea/GitTag.java +++ b/plugins/git4idea/src/git4idea/GitTag.java @@ -76,7 +76,7 @@ public class GitTag extends GitReference { if (line.length() == 0) { continue; } - tags.add(line); + tags.add(new String(line)); } } diff --git a/plugins/git4idea/src/git4idea/GitUtil.java b/plugins/git4idea/src/git4idea/GitUtil.java index b131efa0b8fb..45b6bddfb3c1 100644 --- a/plugins/git4idea/src/git4idea/GitUtil.java +++ b/plugins/git4idea/src/git4idea/GitUtil.java @@ -713,7 +713,7 @@ public class GitUtil { if (file == null || path.length == 0) return null; VirtualFile current = file; - final List backTrace = new LinkedList(); + final List backTrace = new ArrayList(); int idx = path.length - 1; while (current != null) { if (SystemInfo.isFileSystemCaseSensitive ? current.getName().equals(path[idx]) : current.getName().equalsIgnoreCase(path[idx])) { diff --git a/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java b/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java index b48d47c575e3..ff3a683a9c5c 100644 --- a/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java +++ b/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java @@ -35,7 +35,10 @@ import git4idea.i18n.GitBundle; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; /** * Base class for actions that affect the entire git repository. @@ -45,7 +48,7 @@ public abstract class GitRepositoryAction extends DumbAwareAction { /** * The task delayed until end of the primary action. These tasks happen after repository refresh. */ - final LinkedList myDelayedTasks = new LinkedList(); + final List myDelayedTasks = new ArrayList(); /** * {@inheritDoc} diff --git a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java index 7b88a704648f..a317c3e77027 100644 --- a/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java +++ b/plugins/git4idea/src/git4idea/changes/GitChangeUtils.java @@ -122,7 +122,7 @@ public class GitChangeUtils { } public static Collection parseDiffForPaths(final String rootPath, final StringScanner s) throws VcsException { - final Collection result = new LinkedList(); + final Collection result = new ArrayList(); while (s.hasMoreData()) { if (s.isEol()) { diff --git a/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java b/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java index 81fa4983cf8c..78bb134f20f6 100644 --- a/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java +++ b/plugins/git4idea/src/git4idea/changes/GitOutgoingChangesProvider.java @@ -98,7 +98,7 @@ public class GitOutgoingChangesProvider implements VcsOutgoingChangesProvider result = new ArrayList(revisions); for (Iterator iterator = result.iterator(); iterator.hasNext();) { final U t = iterator.next(); - final LinkedList branches = new LinkedList(); + final List branches = new ArrayList(); // we do not use passed revision convertor since it returns just recent commit on repo final VcsRevisionNumber revision = GitHistoryUtils.getCurrentRevision(myProject, filePatchConvertor.convert(t), null); if (revision == null) continue; // will be true for new files; they are anyway outgoing diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index 9e39a986c89b..d3f11f0e021b 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -48,7 +48,7 @@ public abstract class GitHandler { protected final GitCommand myCommand; private final HashSet myIgnoredErrorCodes = new HashSet(); // Error codes that are ignored for the handler - private final List myErrors = Collections.synchronizedList(new LinkedList()); + private final List myErrors = Collections.synchronizedList(new ArrayList()); private static final Logger log = Logger.getInstance(GitHandler.class.getName()); final GeneralCommandLine myCommandLine; @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"}) diff --git a/plugins/git4idea/src/git4idea/history/GitLogParser.java b/plugins/git4idea/src/git4idea/history/GitLogParser.java index face9e3b0bd6..1d226a19aca2 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogParser.java +++ b/plugins/git4idea/src/git4idea/history/GitLogParser.java @@ -161,10 +161,10 @@ class GitLogParser { line = infoAndPath[0]; if (infoAndPath.length > 1) { // taking the last element, thus avoiding possible blank line - final List nameAndPathSplit = new LinkedList(Arrays.asList(infoAndPath[infoAndPath.length-1].split("[\\s]"))); + final List nameAndPathSplit = new ArrayList(Arrays.asList(infoAndPath[infoAndPath.length - 1].split("[\\s]"))); // not relying that separator is tab => so splitting by any whitespace. // Then removing blank (or whitespace) lines which could appear by this splitting: - for (Iterator it = nameAndPathSplit.iterator(); it.hasNext(); ) { + for (Iterator it = nameAndPathSplit.iterator(); it.hasNext();) { if (it.next().trim().isEmpty()) { it.remove(); } diff --git a/plugins/git4idea/src/git4idea/history/GitLogRecord.java b/plugins/git4idea/src/git4idea/history/GitLogRecord.java index 240ef0318d01..5d2f34aa6199 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogRecord.java +++ b/plugins/git4idea/src/git4idea/history/GitLogRecord.java @@ -70,15 +70,19 @@ class GitLogRecord { return res; } + private String lookup(GitLogParser.GitLogOption key) { + return shortBuffer(myOptions.get(key)); + } + // trivial access methods - String getHash() { return myOptions.get(HASH); } - String getShortHash() { return myOptions.get(SHORT_HASH); } - String getAuthorName() { return myOptions.get(AUTHOR_NAME); } - String getAuthorEmail() { return myOptions.get(AUTHOR_EMAIL); } - String getCommitterName() { return myOptions.get(COMMITTER_NAME); } - String getCommitterEmail() { return myOptions.get(COMMITTER_EMAIL); } - String getSubject() { return myOptions.get(SUBJECT); } - String getBody() { return myOptions.get(BODY); } + String getHash() { return lookup(HASH); } + String getShortHash() { return lookup(SHORT_HASH); } + String getAuthorName() { return lookup(AUTHOR_NAME); } + String getAuthorEmail() { return lookup(AUTHOR_EMAIL); } + String getCommitterName() { return lookup(COMMITTER_NAME); } + String getCommitterEmail() { return lookup(COMMITTER_EMAIL); } + String getSubject() { return lookup(SUBJECT); } + String getBody() { return lookup(BODY); } // access methods with some formatting or conversion @@ -101,11 +105,11 @@ class GitLogRecord { } String[] getParentsShortHashes() { - return myOptions.get(SHORT_PARENTS).split(" "); + return lookup(SHORT_PARENTS).split(" "); } String[] getParentsHashes() { - return myOptions.get(PARENTS).split(" "); + return lookup(PARENTS).split(" "); } /** @@ -117,17 +121,17 @@ class GitLogRecord { Pair, List> getTagsAndBranches(Collection allBranchesSet) { final String decorate = myOptions.get(REF_NAMES); final String[] refNames = parseRefNames(decorate); - final List tags = refNames.length > 0 ? new LinkedList() : Collections.emptyList(); - final List branches = refNames.length > 0 ? new LinkedList() : Collections.emptyList(); + final List tags = refNames.length > 0 ? new ArrayList() : Collections.emptyList(); + final List branches = refNames.length > 0 ? new ArrayList() : Collections.emptyList(); for (String refName : refNames) { if (allBranchesSet.contains(refName)) { // also some gits can return ref name twice (like (HEAD, HEAD), so check we will show it only once) if (!branches.contains(refName)) { - branches.add(refName); + branches.add(shortBuffer(refName)); } } else { if (!tags.contains(refName)) { - tags.add(refName); + tags.add(shortBuffer(refName)); } } } @@ -142,4 +146,8 @@ class GitLogRecord { return refs.split(", "); } + private static String shortBuffer(String raw) { + return new String(raw); + } + } diff --git a/plugins/git4idea/src/git4idea/history/GitUsersComponent.java b/plugins/git4idea/src/git4idea/history/GitUsersComponent.java index 2d02aa2071a3..2411513bc72e 100644 --- a/plugins/git4idea/src/git4idea/history/GitUsersComponent.java +++ b/plugins/git4idea/src/git4idea/history/GitUsersComponent.java @@ -174,7 +174,7 @@ public class GitUsersComponent { private boolean myStartReached; private UsersData() { - myUsers = new LinkedList(); + myUsers = new ArrayList(); final long now = System.currentTimeMillis(); myCloserDate = new UpdatedReference(now); myEarlierDate = new UpdatedReference(now + 1); @@ -327,7 +327,7 @@ public class GitUsersComponent { final long earlierUpdate = in.readLong(); data.setEarlierDate(new UpdatedReference(earlierDate, earlierUpdate)); - final List users = new LinkedList(); + final List users = new ArrayList(); final int size = in.readInt(); for (int i = 0; i < size; i++) { users.add(in.readUTF()); diff --git a/plugins/git4idea/src/git4idea/history/browser/ChangesFilter.java b/plugins/git4idea/src/git4idea/history/browser/ChangesFilter.java index bd692c40ce6a..3f3cd75ce51b 100644 --- a/plugins/git4idea/src/git4idea/history/browser/ChangesFilter.java +++ b/plugins/git4idea/src/git4idea/history/browser/ChangesFilter.java @@ -36,7 +36,7 @@ public class ChangesFilter { private MemoryFilter myResult; protected Merger() { - myFilters = new LinkedList(); + myFilters = new ArrayList(); } protected abstract boolean acceptImpl(MemoryFilter filter); @@ -81,7 +81,7 @@ public class ChangesFilter { final Merger[] mergers = {new UsersMerger()}; if (filters.isEmpty()) return Collections.emptyList(); - final List result = new LinkedList(); + final List result = new ArrayList(); for (Filter filter : filters) { boolean taken = false; for (Merger combiner : mergers) { @@ -361,7 +361,7 @@ public class ChangesFilter { // todo optimization here public boolean addPath(final VirtualFile vf) { final Collection filesWeAlreadyHave = myMap.values(); - final Collection childrenToRemove = new LinkedList(); + final Collection childrenToRemove = new ArrayList(); for (VirtualFile current : filesWeAlreadyHave) { if (current.equals(vf)) return false; // doesnt add exact same if (VfsUtil.isAncestor(vf, current, false)) { diff --git a/plugins/git4idea/src/git4idea/history/browser/CherryPicker.java b/plugins/git4idea/src/git4idea/history/browser/CherryPicker.java index cf9b6b1c6502..4aa724e8442b 100644 --- a/plugins/git4idea/src/git4idea/history/browser/CherryPicker.java +++ b/plugins/git4idea/src/git4idea/history/browser/CherryPicker.java @@ -51,10 +51,10 @@ public class CherryPicker { myListsCache = listsCache; myAccess = access; - myExceptions = new LinkedList(); - myWarnings = new LinkedList(); + myExceptions = new ArrayList(); + myWarnings = new ArrayList(); - myDirtyFiles = new LinkedList(); + myDirtyFiles = new ArrayList(); myMessagesInOrder = new ArrayList(hashes.size()); myFilesToMove = new HashMap>(); } diff --git a/plugins/git4idea/src/git4idea/history/browser/GitLogHelper.java b/plugins/git4idea/src/git4idea/history/browser/GitLogHelper.java index fa6f1fed1d33..9e88a0b5d346 100644 --- a/plugins/git4idea/src/git4idea/history/browser/GitLogHelper.java +++ b/plugins/git4idea/src/git4idea/history/browser/GitLogHelper.java @@ -30,7 +30,7 @@ public class GitLogHelper { @NotNull public Portion loadPortion(final Collection startingPoints, final Date beforePoint, final Date afterPoint, final Collection filtersIn, int maxCnt, List branches) throws VcsException { - final Collection filters = new LinkedList(filtersIn); + final Collection filters = new ArrayList(filtersIn); if (beforePoint != null) { filters.add(new ChangesFilter.BeforeDate(new Date(beforePoint.getTime() - 1))); } diff --git a/plugins/git4idea/src/git4idea/history/browser/GitLogTree.java b/plugins/git4idea/src/git4idea/history/browser/GitLogTree.java index 7c8491bc0e21..5e53324d1d5a 100644 --- a/plugins/git4idea/src/git4idea/history/browser/GitLogTree.java +++ b/plugins/git4idea/src/git4idea/history/browser/GitLogTree.java @@ -114,7 +114,7 @@ public class GitLogTree implements GitTreeViewI { myMainSplitter.setDividerWidth(3); myFiltersSplitter.setDividerWidth(3); - myInitWaiters = new LinkedList(); + myInitWaiters = new ArrayList(); myCommitsList = new JBList(); myController.init(); } @@ -1547,7 +1547,7 @@ public class GitLogTree implements GitTreeViewI { if (wasEmpty) { myFiltering.addFilter(myFilter); } else { - final List toRemove = new LinkedList(); + final List toRemove = new ArrayList(); for (StructureNode child : getChildren()) { final VirtualFile file = child.getFile(); if (! myFilter.containsFile(file)) { @@ -1657,7 +1657,7 @@ public class GitLogTree implements GitTreeViewI { myText = text; myType = type; myIcon = icon; - myChildren = myAllowsChildren ? new LinkedList() : Collections.emptyList(); + myChildren = myAllowsChildren ? new ArrayList() : Collections.emptyList(); myDescriptor = new PresentableNodeDescriptor(myProject, myParent == null ? null : myParent.getDescriptor()) { @Override public PresentableNodeDescriptor getChildToHighlightAt(int index) { diff --git a/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java b/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java index 6e19dce17cf1..f2239f97b56c 100644 --- a/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java +++ b/plugins/git4idea/src/git4idea/history/browser/LowLevelAccessImpl.java @@ -50,7 +50,7 @@ public class LowLevelAccessImpl implements LowLevelAccess { @NotNull final Collection endPoints, @NotNull final Collection filters, int useMaxCnt) throws VcsException { - final List parameters = new LinkedList(); + final List parameters = new ArrayList(); if (useMaxCnt > 0) { parameters.add("--max-count=" + useMaxCnt); } @@ -76,7 +76,7 @@ public class LowLevelAccessImpl implements LowLevelAccess { public Runnable loadHashesWithParents(final @NotNull Collection startingPoints, @NotNull final Collection filters, final Consumer consumer) throws VcsException { - final List parameters = new LinkedList(); + final List parameters = new ArrayList(); for (ChangesFilter.Filter filter : filters) { filter.getCommandParametersFilter().applyToCommandLine(parameters); } @@ -101,7 +101,7 @@ public class LowLevelAccessImpl implements LowLevelAccess { public void loadCommits(final Collection startingPoints, final Date beforePoint, final Date afterPoint, final Collection filtersIn, final Consumer consumer, int maxCnt, List branches) throws VcsException { - final Collection filters = new LinkedList(filtersIn); + final Collection filters = new ArrayList(filtersIn); if (beforePoint != null) { filters.add(new ChangesFilter.BeforeDate(new Date(beforePoint.getTime() - 1))); } @@ -136,7 +136,7 @@ public class LowLevelAccessImpl implements LowLevelAccess { @NotNull final Consumer consumer, final Collection branches, int useMaxCnt) throws VcsException { - final List parameters = new LinkedList(); + final List parameters = new ArrayList(); if (useMaxCnt > 0) { parameters.add("--max-count=" + (useMaxCnt + 1)); } @@ -166,14 +166,14 @@ public class LowLevelAccessImpl implements LowLevelAccess { } public Collection getBranchesWithCommit(final SHAHash hash) throws VcsException { - final List result = new LinkedList(); + final List result = new ArrayList(); GitBranch.listAsStrings(myProject, myRoot, false, true, result, hash.getValue()); GitBranch.listAsStrings(myProject, myRoot, true, false, result, hash.getValue()); return result; } public Collection getTagsWithCommit(final SHAHash hash) throws VcsException { - final List result = new LinkedList(); + final List result = new ArrayList(); GitTag.listAsStrings(myProject, myRoot, result, hash.getValue()); return result; } diff --git a/plugins/git4idea/src/git4idea/history/browser/Portion.java b/plugins/git4idea/src/git4idea/history/browser/Portion.java index fc9968f5c764..ed9b0cc46293 100644 --- a/plugins/git4idea/src/git4idea/history/browser/Portion.java +++ b/plugins/git4idea/src/git4idea/history/browser/Portion.java @@ -49,10 +49,10 @@ public class Portion implements AsynchConsumer { myNameToHash = new HashMap(); myHolder = new HashMap(); - myOrdered = new LinkedList(); + myOrdered = new ArrayList(); - myRoots = new LinkedList(); - myLeafs = new LinkedList(); + myRoots = new ArrayList(); + myLeafs = new ArrayList(); myOrphanMap = new MultiMap(); myUsers = new HashSet(); diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/LoaderImpl.java b/plugins/git4idea/src/git4idea/history/wholeTree/LoaderImpl.java index 7d6676d89731..2aa296231365 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/LoaderImpl.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/LoaderImpl.java @@ -160,7 +160,7 @@ public class LoaderImpl implements Loader { myTreeComposite.clearMembers(); - final List endOfTheList = new LinkedList(); + final List endOfTheList = new ArrayList(); final Consumer consumer = createCommitsHolderConsumer(drawHierarchy); final RefreshingCommitsPackConsumer listConsumer = new RefreshingCommitsPackConsumer(current, consumer); diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/TreeSkeletonImpl.java b/plugins/git4idea/src/git4idea/history/wholeTree/TreeSkeletonImpl.java index b3fe3da345f0..b03fe528f40b 100644 --- a/plugins/git4idea/src/git4idea/history/wholeTree/TreeSkeletonImpl.java +++ b/plugins/git4idea/src/git4idea/history/wholeTree/TreeSkeletonImpl.java @@ -44,7 +44,7 @@ public class TreeSkeletonImpl implements TreeSkeleton { assert (size2Power < 16) && (wireEventsIdxSize2Power < 16) && (size2Power > 1) && (wireEventsIdxSize2Power > 1); myList = new BigArray(size2Power); - myWireEvents = new LinkedList(); // todo can use another structure, a list of arrays? + myWireEvents = new ArrayList(); // todo can use another structure, a list of arrays? myWiresIndex = new WiresIndex(wireEventsIdxSize2Power); myAsCommitList = new ReadonlyList() { @Override diff --git a/plugins/git4idea/src/git4idea/ui/CurrentBranchDialog.java b/plugins/git4idea/src/git4idea/ui/CurrentBranchDialog.java index 0a5b1adcb2e2..e779d08fdd02 100644 --- a/plugins/git4idea/src/git4idea/ui/CurrentBranchDialog.java +++ b/plugins/git4idea/src/git4idea/ui/CurrentBranchDialog.java @@ -26,7 +26,7 @@ import git4idea.i18n.GitBundle; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; /** @@ -68,7 +68,7 @@ public class CurrentBranchDialog extends DialogWrapper { /** * The branches to merge */ - private final List myBranches = new LinkedList(); + private final List myBranches = new ArrayList(); /** * The repository tracked for the current branch */ diff --git a/plugins/git4idea/src/git4idea/vfs/GitIgnoreTracker.java b/plugins/git4idea/src/git4idea/vfs/GitIgnoreTracker.java index 8ceb2f769fda..0e3f4ebb2057 100644 --- a/plugins/git4idea/src/git4idea/vfs/GitIgnoreTracker.java +++ b/plugins/git4idea/src/git4idea/vfs/GitIgnoreTracker.java @@ -31,7 +31,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; -import java.util.LinkedList; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Set; @@ -341,10 +342,10 @@ public class GitIgnoreTracker { */ private void checkExcludeFile(VirtualFile file) { String path = file.getPath(); - LinkedList toDirty = null; + List toDirty = null; synchronized (myExcludeFiles) { if (myExcludeFilesPaths.contains(path)) { - toDirty = new LinkedList(); + toDirty = new ArrayList(); for (Map.Entry entry : myExcludeFiles.entrySet()) { if (path.equals(entry.getValue())) { toDirty.add(entry.getKey()); diff --git a/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHConfig.java b/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHConfig.java index 14c4b3b65822..00a065da7114 100644 --- a/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHConfig.java +++ b/plugins/git4idea/src/org/jetbrains/git4idea/ssh/SSHConfig.java @@ -158,7 +158,7 @@ public class SSHConfig { host.myPort = parseInt(argument); } else if ("PreferredAuthentications".equalsIgnoreCase(keyword)) { - final LinkedList list = parseList(argument); + final List list = parseList(argument); list.retainAll(ALLOWED_METHODS); if (!list.isEmpty()) { host.myPreferredMethods = Collections.unmodifiableList(list); @@ -254,8 +254,8 @@ public class SSHConfig { return "yes".equals(value); } - private static LinkedList parseList(final String arg) { - LinkedList values = new LinkedList(); + private static List parseList(final String arg) { + List values = new ArrayList(); for (String a : arg.split("[ \t,]+")) { if (a.length() == 0) { continue;