CR-IC-6786 createSmartList -> createSmart

This commit is contained in:
Vladimir Krivosheev
2014-12-29 11:33:21 +01:00
parent a8be778da0
commit 44b584a72d
14 changed files with 40 additions and 31 deletions
@@ -52,7 +52,7 @@ public class ArchivedTemplatesFactory extends ProjectTemplatesFactory {
@NotNull
@Override
protected MultiMap<String, Pair<URL, ClassLoader>> compute() {
MultiMap<String, Pair<URL, ClassLoader>> map = MultiMap.createSmartList();
MultiMap<String, Pair<URL, ClassLoader>> map = MultiMap.createSmart();
Map<URL, ClassLoader> urls = new THashMap<URL, ClassLoader>();
//for (IdeaPluginDescriptor plugin : plugins) {
// if (!plugin.isEnabled()) continue;
@@ -105,24 +105,22 @@ public class RemoteTemplatesFactory extends ProjectTemplatesFactory {
@NotNull
private static MultiMap<String, ArchivedProjectTemplate> create(@NotNull Element element) throws IOException, JDOMException {
MultiMap<String, ArchivedProjectTemplate> map = MultiMap.createSmartList();
MultiMap<String, ArchivedProjectTemplate> map = MultiMap.createSmart();
for (ArchivedProjectTemplate template : createGroupTemplates(element)) {
map.putValue(template.getCategory(), template);
}
return map;
}
@SuppressWarnings("unchecked")
private static List<ArchivedProjectTemplate> createGroupTemplates(Element groupElement) {
List<Element> elements = groupElement.getChildren(TEMPLATE);
return ContainerUtil.mapNotNull(elements, new NullableFunction<Element, ArchivedProjectTemplate>() {
return ContainerUtil.mapNotNull(groupElement.getChildren(TEMPLATE), new NullableFunction<Element, ArchivedProjectTemplate>() {
@Override
public ArchivedProjectTemplate fun(final Element element) {
if (!checkRequiredPlugins(element)) return null;
String type = element.getChildText("moduleType");
final ModuleType moduleType = ModuleTypeManager.getInstance().findByID(type);
if (!checkRequiredPlugins(element)) {
return null;
}
final ModuleType moduleType = ModuleTypeManager.getInstance().findByID(element.getChildText("moduleType"));
final String path = element.getChildText("path");
final String description = element.getChildTextTrim("description");
String name = element.getChildTextTrim("name");
@@ -182,8 +182,8 @@ public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> ext
mySdks.add(defaultJdk);
mySdks.add(otherJdk);
Sdk[] jdks = jdkTable.getAllJdks();
System.out.println(Arrays.asList(jdks));
//noinspection UseOfSystemOutOrSystemErr
System.out.println(Arrays.asList(jdkTable.getAllJdks()));
if (getName().contains("DefaultSdk")) {
Project defaultProject = ProjectManager.getInstance().getDefaultProject();
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.Collection;
class HighlightersRecycler {
private final MultiMap<TextRange, RangeHighlighter> incinerator = MultiMap.createSmartList();
private final MultiMap<TextRange, RangeHighlighter> incinerator = MultiMap.createSmart();
void recycleHighlighter(@NotNull RangeHighlighter highlighter) {
if (highlighter.isValid()) {
@@ -278,7 +278,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
StringInterner interner = new StringInterner();
List<Element> extensions = copyElements(pluginBean.extensions, interner);
if (extensions != null) {
myExtensions = MultiMap.createSmartList();
myExtensions = MultiMap.createSmart();
for (Element extension : extensions) {
myExtensions.putValue(ExtensionsAreaImpl.extractEPName(extension), extension);
}
@@ -286,7 +286,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
List<Element> extensionPoints = copyElements(pluginBean.extensionPoints, interner);
if (extensionPoints != null) {
myExtensionsPoints = MultiMap.createSmartList();
myExtensionsPoints = MultiMap.createSmart();
for (Element extensionPoint : extensionPoints) {
myExtensionsPoints.putValue(StringUtil.notNullize(extensionPoint.getAttributeValue(ExtensionsAreaImpl.ATTRIBUTE_AREA)), extensionPoint);
}
@@ -49,7 +49,7 @@ public class ExtensionsAreaImpl implements ExtensionsArea {
private final Throwable myCreationTrace;
private final Map<String, ExtensionPointImpl> myExtensionPoints = ContainerUtil.newConcurrentMap();
private final Map<String,Throwable> myEPTraces = DEBUG_REGISTRATION ? new THashMap<String, Throwable>():null;
private final MultiMap<String, ExtensionPointAvailabilityListener> myAvailabilityListeners = MultiMap.createSmartList();
private final MultiMap<String, ExtensionPointAvailabilityListener> myAvailabilityListeners = MultiMap.createSmart();
private final List<Runnable> mySuspendedListenerActions = new ArrayList<Runnable>();
private boolean myAvailabilityNotificationsActive = true;
@@ -854,7 +854,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
@NotNull
private static MultiMap<VirtualFile, RequestWithProcessor> createMultiMap() {
// usually there is just one request
return MultiMap.createSmartList();
return MultiMap.createSmart();
}
@NotNull
@@ -34,7 +34,7 @@ import static com.intellij.util.containers.ContainerUtil.newIdentityTroveSet;
*/
public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
private final TreeSet<String> mySortedStrings = new TreeSet<String>();
private final MultiMap<String, LookupElement> myElements = MultiMap.createSmartList();
private final MultiMap<String, LookupElement> myElements = MultiMap.createSmart();
private final Map<LookupElement, FList<LookupElement>> myToLift = newIdentityHashMap();
private final IdentityHashMap<FList<LookupElement>, IdentityHashMap<LookupElement, FList<LookupElement>>> myPrepends = newIdentityHashMap();
private final String myName;
@@ -114,8 +114,8 @@ public class PassExecutorService implements Disposable {
// null keys are ok
MultiMap<Document, FileEditor> documentToEditors = MultiMap.createSet();
MultiMap<FileEditor, TextEditorHighlightingPass> documentBoundPasses = MultiMap.createSmartList();
MultiMap<FileEditor, EditorBoundHighlightingPass> editorBoundPasses = MultiMap.createSmartList();
MultiMap<FileEditor, TextEditorHighlightingPass> documentBoundPasses = MultiMap.createSmart();
MultiMap<FileEditor, EditorBoundHighlightingPass> editorBoundPasses = MultiMap.createSmart();
for (Map.Entry<FileEditor, HighlightingPass[]> entry : passesMap.entrySet()) {
FileEditor fileEditor = entry.getKey();
HighlightingPass[] passes = entry.getValue();
@@ -94,7 +94,7 @@ public class SemServiceImpl extends SemService{
}
private static MultiMap<SemKey, SemKey> cacheKeyHierarchy(Collection<SemKey> allKeys) {
final MultiMap<SemKey, SemKey> result = MultiMap.createSmartList();
final MultiMap<SemKey, SemKey> result = MultiMap.createSmart();
ContainerUtil.process(allKeys, new Processor<SemKey>() {
@Override
public boolean process(SemKey key) {
@@ -115,7 +115,7 @@ public class SemServiceImpl extends SemService{
}
private MultiMap<SemKey, NullableFunction<PsiElement, ? extends SemElement>> collectProducers() {
final MultiMap<SemKey, NullableFunction<PsiElement, ? extends SemElement>> map = MultiMap.createSmartList();
final MultiMap<SemKey, NullableFunction<PsiElement, ? extends SemElement>> map = MultiMap.createSmart();
final SemRegistrar registrar = new SemRegistrar() {
@Override
@@ -174,9 +174,9 @@ public class RootIndex {
Map<VirtualFile, OrderEntry[]> result = myOrderEntries;
if (result != null) return result;
MultiMap<VirtualFile, OrderEntry> libClassRootEntries = MultiMap.createSmartList();
MultiMap<VirtualFile, OrderEntry> libSourceRootEntries = MultiMap.createSmartList();
MultiMap<VirtualFile, OrderEntry> depEntries = MultiMap.createSmartList();
MultiMap<VirtualFile, OrderEntry> libClassRootEntries = MultiMap.createSmart();
MultiMap<VirtualFile, OrderEntry> libSourceRootEntries = MultiMap.createSmart();
MultiMap<VirtualFile, OrderEntry> depEntries = MultiMap.createSmart();
for (final Module module : ModuleManager.getInstance(myProject).getModules()) {
final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
@@ -442,9 +442,9 @@ public class RootIndex {
@NotNull final Map<VirtualFile, Module> contentRootOf = ContainerUtil.newHashMap();
@NotNull final MultiMap<VirtualFile, Module> sourceRootOf = MultiMap.createSet();
@NotNull final TObjectIntHashMap<VirtualFile> rootTypeId = new TObjectIntHashMap<VirtualFile>();
@NotNull final MultiMap<VirtualFile, Library> excludedFromLibraries = MultiMap.createSmartList();
@NotNull final MultiMap<VirtualFile, Library> classOfLibraries = MultiMap.createSmartList();
@NotNull final MultiMap<VirtualFile, Library> sourceOfLibraries = MultiMap.createSmartList();
@NotNull final MultiMap<VirtualFile, Library> excludedFromLibraries = MultiMap.createSmart();
@NotNull final MultiMap<VirtualFile, Library> classOfLibraries = MultiMap.createSmart();
@NotNull final MultiMap<VirtualFile, Library> sourceOfLibraries = MultiMap.createSmart();
@NotNull final Set<VirtualFile> excludedFromProject = ContainerUtil.newHashSet();
@NotNull final Map<VirtualFile, Module> excludedFromModule = ContainerUtil.newHashMap();
@NotNull final Map<VirtualFile, String> packagePrefix = ContainerUtil.newHashMap();
@@ -26,7 +26,7 @@ import java.io.Serializable;
import java.util.*;
/**
* Consider to use factory methods {@link #createLinked()}, {@link #createSet()}, {@link #createSmartList()}, {@link #create(gnu.trove.TObjectHashingStrategy)} instead of override.
* Consider to use factory methods {@link #createLinked()}, {@link #createSet()}, {@link #createSmart()}, {@link #create(gnu.trove.TObjectHashingStrategy)} instead of override.
* @see com.intellij.util.containers.BidirectionalMultiMap
* @see com.intellij.util.containers.ConcurrentMultiMap
* @author Dmitry Avdeev
@@ -280,8 +280,18 @@ public class MultiMap<K, V> implements Serializable {
};
}
@Deprecated
@SuppressWarnings("unused")
@NotNull
/**
* @deprecated Use {@link #createSmart()}
*/
public static <K, V> MultiMap<K, V> createSmartList() {
return createSmart();
}
@NotNull
public static <K, V> MultiMap<K, V> createSmart() {
return new MultiMap<K, V>() {
@NotNull
@Override
@@ -53,7 +53,7 @@ public class RefsModel implements VcsLogRefs {
@NotNull
private static MultiMap<Hash, VcsRef> prepareRefsMap(@NotNull Collection<VcsRef> refs) {
MultiMap<Hash, VcsRef> map = MultiMap.createSmartList();
MultiMap<Hash, VcsRef> map = MultiMap.createSmart();
for (VcsRef ref : refs) {
map.putValue(ref.getCommitHash(), ref);
}
@@ -44,7 +44,8 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
/**
* author: lesya
@@ -66,7 +67,7 @@ public class IgnoreFileAction extends AnAction implements DumbAware {
}
public void actionPerformed(AnActionEvent e) {
final MultiMap<VirtualFile, VirtualFile> parentToSelectedChildren = MultiMap.createSmartList();
final MultiMap<VirtualFile, VirtualFile> parentToSelectedChildren = MultiMap.createSmart();
final CvsContext context = CvsContextWrapper.createCachedInstance(e);
final VirtualFile[] selectedFiles = context.getSelectedFiles();
for (VirtualFile selectedFile : selectedFiles) {