Migrate CollectionFactory to ContainerUtil

This commit is contained in:
Roman Shevchenko
2012-09-01 12:55:20 +04:00
parent fc98262caf
commit 32810eb66b
60 changed files with 497 additions and 321 deletions
@@ -63,7 +63,7 @@ import com.intellij.util.IncorrectOperationException;
import com.intellij.util.NullableFunction;
import com.intellij.util.PairConsumer;
import com.intellij.util.PairFunction;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -615,7 +615,7 @@ public class JavaCompletionUtil {
}
public static Set<String> getAllLookupStrings(@NotNull PsiMember member) {
Set<String> allLookupStrings = CollectionFactory.linkedHashSet();
Set<String> allLookupStrings = ContainerUtil.newLinkedHashSet();
String name = member.getName();
allLookupStrings.add(name);
PsiClass containingClass = member.getContainingClass();
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 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.
*/
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.daemon.impl.quickfix.StaticImportMethodFix;
@@ -10,25 +25,20 @@ import com.intellij.psi.impl.java.stubs.index.JavaStaticMemberNameIndex;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.Consumer;
import com.intellij.util.PairConsumer;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.*;
import static com.intellij.util.containers.CollectionFactory.hashSet;
import static com.intellij.util.containers.ContainerUtil.addIfNotNull;
/**
* @author peter
*/
public abstract class StaticMemberProcessor {
private final Set<PsiClass> myStaticImportedClasses = hashSet();
private final Set<PsiClass> myStaticImportedClasses = ContainerUtil.newHashSet();
private final PsiElement myPosition;
private final Project myProject;
private final PsiResolveHelper myResolveHelper;
@@ -98,7 +108,7 @@ public abstract class StaticMemberProcessor {
}
public List<PsiMember> processMembersOfRegisteredClasses(final PrefixMatcher matcher, PairConsumer<PsiMember, PsiClass> consumer) {
final ArrayList<PsiMember> result = CollectionFactory.arrayList();
final ArrayList<PsiMember> result = ContainerUtil.newArrayList();
for (final PsiClass psiClass : myStaticImportedClasses) {
for (final PsiMethod method : psiClass.getAllMethods()) {
if (matcher.prefixMatches(method.getName())) {
@@ -15,7 +15,6 @@
*/
package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.daemon.JavaErrorMessages;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
@@ -37,6 +36,7 @@ import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.search.searches.SuperMethodsSearch;
import com.intellij.psi.util.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.HashSet;
import gnu.trove.THashMap;
@@ -950,7 +950,7 @@ public class GenericsHighlightUtil {
@Nullable
public static Collection<HighlightInfo> checkCatchParameterIsClass(PsiParameter parameter) {
if (!(parameter.getDeclarationScope() instanceof PsiCatchSection)) return null;
final Collection<HighlightInfo> result = CollectionFactory.arrayList();
final Collection<HighlightInfo> result = ContainerUtil.newArrayList();
final List<PsiTypeElement> typeElements = PsiUtil.getParameterTypeElements(parameter);
for (PsiTypeElement typeElement : typeElements) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -23,7 +23,7 @@ import com.intellij.psi.PsiArrayType;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiType;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -42,7 +42,7 @@ public class ComponentTypeOfMacro extends Macro {
LookupElement[] lookupItems = params[0].calculateLookupItems(context);
if (lookupItems == null) return null;
List<LookupElement> result = CollectionFactory.arrayList();
List<LookupElement> result = ContainerUtil.newArrayList();
for (LookupElement element : lookupItems) {
PsiTypeLookupItem lookupItem = element.as(PsiTypeLookupItem.CLASS_CONDITION_KEY);
if (lookupItem != null) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -20,7 +20,7 @@ import com.intellij.lang.java.JavaLanguage;
import com.intellij.psi.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -40,7 +40,7 @@ public class LightModifierList extends LightElement implements PsiModifierList {
public LightModifierList(PsiManager manager, final Language language, String... modifiers) {
super(manager, language);
myModifiers = CollectionFactory.troveSet(modifiers);
myModifiers = ContainerUtil.newTroveSet(modifiers);
}
public void addModifier(String modifier) {
@@ -27,7 +27,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.IFileElementType;
import com.intellij.psi.tree.ILightStubFileElementType;
import com.intellij.util.CharTable;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.Stack;
import com.intellij.util.diff.FlyweightCapableTreeStructure;
import gnu.trove.TIntStack;
@@ -35,7 +35,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -74,8 +73,8 @@ public class LightStubBuilder implements StubBuilder {
return rootStub;
}
@SuppressWarnings("unchecked")
protected StubElement createStubForFile(final PsiFile file, final LighterAST tree) {
//noinspection unchecked
return new PsiFileStubImpl(file);
}
@@ -190,7 +189,7 @@ public class LightStubBuilder implements StubBuilder {
public List<LighterASTNode> getChildren(@NotNull final LighterASTNode parent) {
final Ref<LighterASTNode[]> into = new Ref<LighterASTNode[]>();
final int numKids = myTreeStructure.getChildren(myTreeStructure.prepareForGetChildren(parent), into);
return numKids > 0 ? CollectionFactory.arrayList(into.get(), 0, numKids) : Collections.<LighterASTNode>emptyList();
return numKids > 0 ? ContainerUtil.newArrayList(into.get(), 0, numKids) : ContainerUtil.<LighterASTNode>emptyList();
}
}
@@ -220,7 +219,7 @@ public class LightStubBuilder implements StubBuilder {
public List<LighterASTNode> getChildren(@NotNull final LighterASTNode parent) {
final ASTNode[] children = ((NodeWrapper)parent).myNode.getChildren(null);
if (children == null || children.length == 0) {
return Collections.emptyList();
return ContainerUtil.emptyList();
}
final ArrayList<LighterASTNode> result = new ArrayList<LighterASTNode>(children.length);
for (final ASTNode child : children) {
@@ -38,10 +38,7 @@ import com.intellij.util.CharTable;
import com.intellij.util.ExceptionUtil;
import com.intellij.util.ThreeState;
import com.intellij.util.TripleFunction;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.Convertor;
import com.intellij.util.containers.LimitedPool;
import com.intellij.util.containers.Stack;
import com.intellij.util.containers.*;
import com.intellij.util.diff.DiffTreeChangeBuilder;
import com.intellij.util.diff.FlyweightCapableTreeStructure;
import com.intellij.util.diff.ShallowNodeComparator;
@@ -1074,7 +1071,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder, AS
final StartMarker rootMarker = (StartMarker)myProduction.get(0);
rootMarker.myParent = rootMarker.myFirstChild = rootMarker.myLastChild = rootMarker.myNext = null;
StartMarker curNode = rootMarker;
final Stack<StartMarker> nodes = new Stack<StartMarker>();
final Stack<StartMarker> nodes = ContainerUtil.newStack();
nodes.push(rootMarker);
@SuppressWarnings({"MultipleVariablesInDeclaration"}) int lastErrorIndex = -1, maxDepth = 0, curDepth = 0;
@@ -1107,12 +1104,12 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder, AS
}
if (myCurrentLexeme < myLexemeCount) {
final List<IElementType> missed = CollectionFactory.arrayList(myLexTypes, myCurrentLexeme, myLexemeCount);
final List<IElementType> missed = ContainerUtil.newArrayList(myLexTypes, myCurrentLexeme, myLexemeCount);
LOG.error("Tokens " + missed + " were not inserted into the tree. " +(myFile != null? myFile.getLanguage()+", ":"")+"Text:\n" + myText);
}
if (rootMarker.myDoneMarker.myLexemeIndex < myLexemeCount) {
final List<IElementType> missed = CollectionFactory.arrayList(myLexTypes, rootMarker.myDoneMarker.myLexemeIndex, myLexemeCount);
final List<IElementType> missed = ContainerUtil.newArrayList(myLexTypes, rootMarker.myDoneMarker.myLexemeIndex, myLexemeCount);
LOG.error("Tokens " + missed + " are outside of root element \"" + rootMarker.myType + "\". Text:\n" + myText);
}
@@ -1686,7 +1683,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder, AS
myFile = (PsiFile)value;
return;
}
if (myUserData == null) myUserData = CollectionFactory.hashMap();
if (myUserData == null) myUserData = ContainerUtil.newHashMap();
myUserData.put(key, value);
}
}
@@ -19,7 +19,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFileSystemItem;
import com.intellij.psi.PsiReference;
import com.intellij.util.Processor;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -30,9 +30,9 @@ import java.util.List;
*/
public class SearchRequestCollector {
private final Object lock = new Object();
private final List<PsiSearchRequest> myWordRequests = CollectionFactory.arrayList();
private final List<QuerySearchRequest> myQueryRequests = CollectionFactory.arrayList();
private final List<Processor<Processor<PsiReference>>> myCustomSearchActions = CollectionFactory.arrayList();
private final List<PsiSearchRequest> myWordRequests = ContainerUtil.newArrayList();
private final List<QuerySearchRequest> myQueryRequests = ContainerUtil.newArrayList();
private final List<Processor<Processor<PsiReference>>> myCustomSearchActions = ContainerUtil.newArrayList();
private final SearchSession mySession;
public SearchRequestCollector(SearchSession session) {
@@ -40,7 +40,6 @@ import com.intellij.util.CommonProcessors;
import com.intellij.util.Processor;
import com.intellij.util.SmartList;
import com.intellij.util.codeInsight.CommentUtilCore;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.indexing.FileBasedIndex;
@@ -475,7 +474,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
@Override
public boolean processRequests(@NotNull SearchRequestCollector collector, @NotNull Processor<PsiReference> processor) {
Map<SearchRequestCollector, Processor<PsiReference>> collectors = CollectionFactory.hashMap();
Map<SearchRequestCollector, Processor<PsiReference>> collectors = ContainerUtil.newHashMap();
collectors.put(collector, processor);
appendCollectorsFromQueryRequests(collectors);
@@ -483,8 +482,8 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
ProgressIndicator progress = ProgressIndicatorProvider.getInstance().getProgressIndicator();
do {
final MultiMap<Set<IdIndexEntry>, RequestWithProcessor> globals = new MultiMap<Set<IdIndexEntry>, RequestWithProcessor>();
final List<Computable<Boolean>> customs = CollectionFactory.arrayList();
final LinkedHashSet<RequestWithProcessor> locals = CollectionFactory.linkedHashSet();
final List<Computable<Boolean>> customs = ContainerUtil.newArrayList();
final LinkedHashSet<RequestWithProcessor> locals = ContainerUtil.newLinkedHashSet();
distributePrimitives(collectors, locals, globals, customs);
if (!processGlobalRequestsOptimized(globals, progress)) {
@@ -45,7 +45,7 @@ import com.intellij.pom.references.PomService;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.Consumer;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -227,7 +227,7 @@ public class TargetElementUtilBase {
public PsiElement getNamedElement(@Nullable final PsiElement element, final int offsetInElement) {
if (element == null) return null;
final List<PomTarget> targets = CollectionFactory.arrayList();
final List<PomTarget> targets = ContainerUtil.newArrayList();
final Consumer<PomTarget> consumer = new Consumer<PomTarget>() {
public void consume(PomTarget target) {
if (target instanceof PsiDeclaredTarget) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -26,9 +26,10 @@ import gnu.trove.THashSet;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.LinkedHashMap;
import static com.intellij.util.containers.CollectionFactory.identityHashMap;
import static com.intellij.util.containers.CollectionFactory.identityTroveSet;
import static com.intellij.util.containers.ContainerUtil.newIdentityHashMap;
import static com.intellij.util.containers.ContainerUtil.newIdentityTroveSet;
/**
* @author peter
@@ -46,9 +47,9 @@ public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
return new ArrayList<LookupElement>(1);
}
};
private final Map<LookupElement, FList<LookupElement>> myToLiftForSorting = identityHashMap();
private final Map<LookupElement, FList<LookupElement>> myToLiftForPreselection = identityHashMap();
private final IdentityHashMap<FList<LookupElement>, IdentityHashMap<LookupElement, FList<LookupElement>>> myPrepends = identityHashMap();
private final Map<LookupElement, FList<LookupElement>> myToLiftForSorting = newIdentityHashMap();
private final Map<LookupElement, FList<LookupElement>> myToLiftForPreselection = newIdentityHashMap();
private final IdentityHashMap<FList<LookupElement>, IdentityHashMap<LookupElement, FList<LookupElement>>> myPrepends = newIdentityHashMap();
private final Classifier<LookupElement> myNext;
private final LiftingCondition myCondition;
private int myCount = 0;
@@ -93,7 +94,7 @@ public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
private FList<LookupElement> prependOrReuse(FList<LookupElement> tail, LookupElement head) {
IdentityHashMap<LookupElement, FList<LookupElement>> cache = myPrepends.get(tail);
if (cache == null) {
myPrepends.put(tail, cache = identityHashMap());
myPrepends.put(tail, cache = newIdentityHashMap());
}
FList<LookupElement> result = cache.get(head);
if (result == null) {
@@ -134,7 +135,7 @@ public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
private Iterable<LookupElement> liftShorterElements(final Iterable<LookupElement> source,
@Nullable final THashSet<LookupElement> lifted, final ProcessingContext context) {
final Set<LookupElement> srcSet = identityTroveSet(source instanceof Collection ? ((Collection)source).size() : myCount);
final Set<LookupElement> srcSet = newIdentityTroveSet(source instanceof Collection ? ((Collection)source).size() : myCount);
ContainerUtil.addAll(srcSet, source);
if (srcSet.size() < 2) {
@@ -146,8 +147,8 @@ public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
@Override
public void describeItems(LinkedHashMap<LookupElement, StringBuilder> map, ProcessingContext context) {
final THashSet<LookupElement> lifted = identityTroveSet();
CollectionFactory.arrayList(liftShorterElements(new ArrayList<LookupElement>(map.keySet()), lifted, context));
final THashSet<LookupElement> lifted = newIdentityTroveSet();
ContainerUtil.newArrayList(liftShorterElements(new ArrayList<LookupElement>(map.keySet()), lifted, context));
if (!lifted.isEmpty()) {
for (LookupElement element : map.keySet()) {
final StringBuilder builder = map.get(element);
@@ -185,8 +186,8 @@ public class LiftShorterItemsClassifier extends Classifier<LookupElement> {
@Override
public Iterator<LookupElement> iterator() {
final Set<LookupElement> processed = identityTroveSet(mySrcSet.size());
final Set<FList<LookupElement>> arraysProcessed = identityTroveSet();
final Set<LookupElement> processed = newIdentityTroveSet(mySrcSet.size());
final Set<FList<LookupElement>> arraysProcessed = newIdentityTroveSet();
final boolean forSorting = myContext.get(CompletionLookupArranger.PURE_RELEVANCE) != Boolean.TRUE;
final Iterable<LookupElement> next = myNext.classify(mySource, myContext);
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 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.
*/
package com.intellij.codeInsight.controlflow;
import com.intellij.codeInsight.controlflow.impl.ConditionalInstructionImpl;
@@ -7,7 +22,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,8 +46,8 @@ public class ControlFlowBuilder {
public int instructionCount;
public ControlFlowBuilder() {
instructions = CollectionFactory.arrayList();
pending = CollectionFactory.arrayList();
instructions = ContainerUtil.newArrayList();
pending = ContainerUtil.newArrayList();
instructionCount = 0;
}
@@ -200,4 +215,4 @@ public class ControlFlowBuilder {
processor.process(pair.getFirst(), pair.getSecond());
}
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -22,7 +22,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPlainText;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -31,8 +31,8 @@ import java.util.List;
import java.util.Set;
public class NaturalLanguageTextSelectioner extends ExtendWordSelectionHandlerBase {
private static final Set<Character> NATURAL = CollectionFactory.troveSet('(', ')', '.', ',', ':', ';', '!', '?', '$', '@', '%', '\"', '\'', '<', '>', '[', ']');
private static final Set<Character> SENTENCE_END = CollectionFactory.troveSet('.', '!', '?');
private static final Set<Character> NATURAL = ContainerUtil.newTroveSet('(', ')', '.', ',', ':', ';', '!', '?', '$', '@', '%', '\"', '\'', '<', '>', '[', ']');
private static final Set<Character> SENTENCE_END = ContainerUtil.newTroveSet('.', '!', '?');
public boolean canSelect(PsiElement e) {
return e instanceof PsiPlainText || e instanceof PsiComment;
@@ -162,4 +162,4 @@ public class NaturalLanguageTextSelectioner extends ExtendWordSelectionHandlerBa
private static boolean isNatural(char c) {
return Character.isWhitespace(c) || Character.isLetterOrDigit(c) || NATURAL.contains(c);
}
}
}
@@ -35,8 +35,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import static com.intellij.util.containers.CollectionFactory.arrayList;
import static com.intellij.util.containers.CollectionFactory.troveMap;
import static com.intellij.util.containers.ContainerUtil.newArrayList;
import static com.intellij.util.containers.ContainerUtil.newTroveMap;
/**
* @author cdr
@@ -70,12 +70,12 @@ class UpdateFoldRegionsOperation implements Runnable {
public void run() {
EditorFoldingInfo info = EditorFoldingInfo.get(myEditor);
FoldingModelEx foldingModel = (FoldingModelEx)myEditor.getFoldingModel();
Map<TextRange,Boolean> rangeToExpandStatusMap = troveMap();
Map<TextRange,Boolean> rangeToExpandStatusMap = newTroveMap();
removeInvalidRegions(info, foldingModel, rangeToExpandStatusMap);
Map<FoldRegion, Boolean> shouldExpand = troveMap();
Map<FoldingGroup, Boolean> groupExpand = troveMap();
Map<FoldRegion, Boolean> shouldExpand = newTroveMap();
Map<FoldingGroup, Boolean> groupExpand = newTroveMap();
List<FoldRegion> newRegions = addNewRegions(info, foldingModel, rangeToExpandStatusMap, shouldExpand, groupExpand);
applyExpandStatus(newRegions, shouldExpand, groupExpand);
@@ -99,7 +99,7 @@ class UpdateFoldRegionsOperation implements Runnable {
@NotNull Map<TextRange, Boolean> rangeToExpandStatusMap,
@NotNull Map<FoldRegion, Boolean> shouldExpand,
@NotNull Map<FoldingGroup, Boolean> groupExpand) {
List<FoldRegion> newRegions = arrayList();
List<FoldRegion> newRegions = newArrayList();
SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(myProject);
for (PsiElement element : myElementsToFoldMap.keySet()) {
ProgressManager.checkCanceled();
@@ -156,7 +156,7 @@ class UpdateFoldRegionsOperation implements Runnable {
private void removeInvalidRegions(@NotNull EditorFoldingInfo info,
@NotNull FoldingModelEx foldingModel,
@NotNull Map<TextRange, Boolean> rangeToExpandStatusMap) {
List<FoldRegion> toRemove = arrayList();
List<FoldRegion> toRemove = newArrayList();
InjectedLanguageManager injectedManager = InjectedLanguageManager.getInstance(myProject);
for (FoldRegion region : foldingModel.getAllFoldRegions()) {
PsiElement element = info.getPsiElement(region);
@@ -1,18 +1,18 @@
/*
* Copyright 2000-2009 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-2012 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.
*/
package com.intellij.codeInsight.template.impl;
@@ -34,7 +34,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -96,7 +96,7 @@ public class ListTemplatesHandler implements CodeInsightActionHandler {
if (description == null) {
return super.getAllLookupStrings();
}
return CollectionFactory.hashSet(getLookupString(), description);
return ContainerUtil.newHashSet(getLookupString(), description);
}
};
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -25,7 +25,6 @@ import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.PsiFile;
import com.intellij.util.Consumer;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -95,7 +94,7 @@ public class LiveTemplateCompletionContributor extends CompletionContributor {
private static List<TemplateImpl> listApplicableTemplates(PsiFile file, int offset) {
Set<TemplateContextType> contextTypes = TemplateManagerImpl.getApplicableContextTypes(file, offset);
final ArrayList<TemplateImpl> result = CollectionFactory.arrayList();
final ArrayList<TemplateImpl> result = ContainerUtil.newArrayList();
for (final TemplateImpl template : TemplateSettings.getInstance().getTemplates()) {
if (!template.isDeactivated() && !template.isSelectionTemplate() && TemplateManagerImpl.isApplicable(template, contextTypes)) {
result.add(template);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -17,7 +17,7 @@ package com.intellij.codeInspection;
import com.intellij.execution.configurations.ParametersList;
import com.intellij.openapi.application.ApplicationStarter;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.sampullara.cli.Args;
import org.jetbrains.annotations.NotNull;
@@ -99,7 +99,7 @@ public abstract class AbstractInspectionToolStarter implements ApplicationStarte
buff.append(" no arguments");
}
else {
final String argString = ParametersList.join(CollectionFactory.arrayList(args, 1, args.length));
final String argString = ParametersList.join(ContainerUtil.newArrayList(args, 1, args.length));
buff.append(argString);
}
}
@@ -16,7 +16,7 @@
package com.intellij.execution.console;
import com.intellij.openapi.components.*;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import java.util.ArrayList;
import java.util.HashSet;
@@ -70,7 +70,7 @@ public class ConsoleFoldingSettings implements PersistentStateComponent<ConsoleF
}
private void writeDiff(List<String> added, List<String> removed, boolean negated) {
Set<String> baseline = CollectionFactory.troveSet();
Set<String> baseline = ContainerUtil.newTroveSet();
for (CustomizableConsoleFoldingBean regexp : CustomizableConsoleFoldingBean.EP_NAME.getExtensions()) {
if (regexp.negate == negated) {
baseline.add(regexp.substring);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -35,7 +35,7 @@ import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.ui.speedSearch.SpeedSearchSupply;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -50,7 +50,7 @@ public abstract class GotoActionBase extends AnAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.actions.GotoActionBase");
protected static Class myInAction = null;
private static final Map<Class, Pair<String, Integer>> ourLastStrings = CollectionFactory.hashMap();
private static final Map<Class, Pair<String, Integer>> ourLastStrings = ContainerUtil.newHashMap();
public final void actionPerformed(AnActionEvent e) {
@@ -39,7 +39,7 @@ import com.intellij.psi.impl.cache.impl.todo.TodoIndexers;
import com.intellij.psi.search.IndexPattern;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.DataIndexer;
import com.intellij.util.indexing.FileBasedIndexImpl;
import com.intellij.util.indexing.FileContent;
@@ -131,7 +131,7 @@ public abstract class PlatformIdTableBuilding {
@NotNull
@Override
public Map<TodoIndexEntry, Integer> map(FileContent inputData) {
Map<TodoIndexEntry, Integer> result = CollectionFactory.troveMap();
Map<TodoIndexEntry, Integer> result = ContainerUtil.newTroveMap();
for (DataIndexer<TodoIndexEntry, Integer, FileContent> indexer : indexers) {
for (Map.Entry<TodoIndexEntry, Integer> entry : indexer.map(inputData).entrySet()) {
TodoIndexEntry key = entry.getKey();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -23,7 +23,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.EnvironmentUtil;
import com.intellij.util.StringBuilderSpinAllocator;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NonNls;
@@ -393,7 +392,7 @@ public class ParametersList implements Cloneable {
public static List<String> decode(@NotNull String parameterString) {
parameterString = parameterString.trim();
final ArrayList<String> params = CollectionFactory.arrayList();
final ArrayList<String> params = ContainerUtil.newArrayList();
final StringBuilder token = new StringBuilder(128);
boolean inQuotes = false;
boolean escapedQuote = false;
@@ -85,7 +85,7 @@ public abstract class ListCellRendererWrapper<T> implements ListCellRenderer {
return separator;
}
final Component component = myOriginalRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
final Component component = new JComboBox().getRenderer().getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (component instanceof JLabel) {
final JLabel label = (JLabel)component;
label.setIcon(myIcon);
@@ -46,14 +46,14 @@ import java.util.Map;
@SuppressWarnings({"NonPrivateFieldAccessedInSynchronizedContext", "FieldAccessedSynchronizedAndUnsynchronized", "UnusedDeclaration"})
public class SimpleColoredComponent extends JComponent implements Accessible {
private static final Logger LOG = Logger.getInstance("#com.intellij.ui.SimpleColoredComponent");
public static final Color STYLE_SEARCH_MATCH_BACKGROUND = new Color(250, 250, 250, 140);
public static final int FRAGMENT_ICON = -2;
private final ArrayList<String> myFragments;
private final ArrayList<SimpleTextAttributes> myAttributes;
private ArrayList<Object> myFragmentTags = null;
public static final int FRAGMENT_ICON = -2;
/**
* Component's icon. It can be <code>null</code>.
*/
@@ -44,7 +44,7 @@ import javax.swing.*;
import java.io.File;
import java.io.IOException;
import static com.intellij.util.containers.CollectionFactory.hashMap;
import static com.intellij.util.containers.ContainerUtil.newHashMap;
import static java.util.Arrays.asList;
public class CreateDesktopEntryAction extends DumbAwareAction {
@@ -151,8 +151,8 @@ public class CreateDesktopEntryAction extends DumbAwareAction {
final String wmClass = AppUIUtil.getFrameClass();
final String content = ExecUtil.loadTemplate(CreateDesktopEntryAction.class.getClassLoader(), "entry.desktop",
hashMap(asList("$NAME$", "$SCRIPT$", "$ICON$", "$WM_CLASS$"),
asList(name, execPath, iconPath, wmClass)));
newHashMap(asList("$NAME$", "$SCRIPT$", "$ICON$", "$WM_CLASS$"),
asList(name, execPath, iconPath, wmClass)));
final String entryName = wmClass + ".desktop";
final File entryFile = new File(FileUtil.getTempDirectory(), entryName);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -37,7 +37,7 @@ import javax.swing.*;
import java.io.File;
import java.io.IOException;
import static com.intellij.util.containers.CollectionFactory.hashMap;
import static com.intellij.util.containers.ContainerUtil.newHashMap;
import static java.util.Arrays.asList;
/**
@@ -139,8 +139,8 @@ public class CreateLauncherScriptAction extends DumbAwareAction {
runPath += "/bin/" + productName + ".sh";
}
final String launcherContents = ExecUtil.loadTemplate(CreateLauncherScriptAction.class.getClassLoader(), "launcher.py",
hashMap(asList("$CONFIG_PATH$", "$RUN_PATH$"),
asList(PathManager.getConfigPath(), runPath)));
newHashMap(asList("$CONFIG_PATH$", "$RUN_PATH$"),
asList(PathManager.getConfigPath(), runPath)));
return ExecUtil.createTempExecutableScript("launcher", "", launcherContents);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -46,7 +46,6 @@ import com.intellij.openapi.wm.*;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.hash.LinkedHashMap;
import com.intellij.util.text.CharArrayUtil;
@@ -73,7 +72,7 @@ public class EventLog {
private static final String A_CLOSING = "</a>";
private static final Pattern TAG_PATTERN = Pattern.compile("<[^>]*>");
private static final Pattern A_PATTERN = Pattern.compile("<a ([^>]* )?href=[\"\']([^>]*)[\"\'][^>]*>");
private static final Set<String> NEW_LINES = CollectionFactory.hashSet("<br>", "</br>", "<br/>", "<p>", "</p>", "<p/>");
private static final Set<String> NEW_LINES = ContainerUtil.newHashSet("<br>", "</br>", "<br/>", "<p>", "</p>", "<p/>");
public EventLog() {
ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, new Notifications() {
@@ -20,7 +20,7 @@ import com.intellij.openapi.editor.FoldRegion;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.util.TextRange;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -40,7 +40,7 @@ abstract class FoldRegionsTree {
private int[] myCachedStartOffsets;
private int[] myCachedFoldedLines;
int myCachedLastIndex = -1;
private ArrayList<FoldRegion> myRegions = CollectionFactory.arrayList(); //sorted in tree left-to-right topdown traversal order
private ArrayList<FoldRegion> myRegions = ContainerUtil.newArrayList(); //sorted in tree left-to-right topdown traversal order
private static final Comparator<FoldRegion> BY_END_OFFSET = new Comparator<FoldRegion>() {
@Override
public int compare(FoldRegion r1, FoldRegion r2) {
@@ -56,7 +56,7 @@ import com.intellij.ui.switcher.QuickAccessSettings;
import com.intellij.ui.switcher.SwitchManager;
import com.intellij.util.Alarm;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.util.ui.PositionTracker;
import com.intellij.util.ui.UIUtil;
@@ -93,7 +93,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
private final Map<String, FloatingDecorator> myId2FloatingDecorator;
private final Map<String, StripeButton> myId2StripeButton;
private final Map<String, FocusWatcher> myId2FocusWatcher;
private final Set<String> myDumbAwareIds = Collections.synchronizedSet(CollectionFactory.<String>troveSet());
private final Set<String> myDumbAwareIds = Collections.synchronizedSet(ContainerUtil.<String>newTroveSet());
private final EditorComponentFocusWatcher myEditorComponentFocusWatcher;
private final MyToolWindowPropertyChangeListener myToolWindowPropertyChangeListener;
@@ -14,9 +14,6 @@
* limitations under the License.
*/
/*
* @author max
*/
package com.intellij.psi.util;
import com.intellij.openapi.util.TextRange;
@@ -26,7 +23,7 @@ import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.ui.SpeedSearchComparator;
import com.intellij.util.ThrowableRunnable;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.Matcher;
import org.jetbrains.annotations.NonNls;
@@ -34,6 +31,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* @author max
* @author peter
* @author Konstantin Bulenkov
*/
@@ -504,10 +502,10 @@ public class NameUtilTest extends UsefulTestCase {
final List<MinusculeMatcher> matching = new ArrayList<MinusculeMatcher>();
final List<MinusculeMatcher> nonMatching = new ArrayList<MinusculeMatcher>();
for (String s : CollectionFactory.ar("*", "*i", "*a", "*u", "T", "ti", longName, longName.substring(0, 20))) {
for (String s : ContainerUtil.ar("*", "*i", "*a", "*u", "T", "ti", longName, longName.substring(0, 20))) {
matching.add(new MinusculeMatcher(s, NameUtil.MatchingCaseSensitivity.NONE));
}
for (String s : CollectionFactory.ar("A", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "tag")) {
for (String s : ContainerUtil.ar("A", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "tag")) {
nonMatching.add(new MinusculeMatcher(s, NameUtil.MatchingCaseSensitivity.NONE));
}
@@ -88,7 +88,7 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl;
import com.intellij.psi.templateLanguages.TemplateDataLanguageMappings;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.LocalTimeCounter;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileBasedIndex;
import com.intellij.util.indexing.IndexableFileSet;
import com.intellij.util.messages.MessageBusConnection;
@@ -812,7 +812,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
final String[] myUrls = mySdk.getRootProvider().getUrls(OrderRootType.CLASSES);
final String[] newUrls = newSdk.getRootProvider().getUrls(OrderRootType.CLASSES);
return CollectionFactory.hashSet(myUrls).equals(CollectionFactory.hashSet(newUrls));
return ContainerUtil.newHashSet(myUrls).equals(ContainerUtil.newHashSet(newUrls));
}
}
}
@@ -31,7 +31,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*
* @since 12.0
*/
@SuppressWarnings({"UtilityClassWithoutPrivateConstructor"})
@SuppressWarnings({"UtilityClassWithoutPrivateConstructor", "UnusedDeclaration"})
public class ContainerUtilRt {
private static final int ARRAY_COPY_THRESHOLD = 20;
@@ -45,6 +45,19 @@ public class ContainerUtilRt {
return new com.intellij.util.containers.HashMap<K, V>(map);
}
@NotNull
public static <K, V> Map<K, V> newHashMap(@NotNull List<K> keys, @NotNull List<V> values) {
if (keys.size() != values.size()) {
throw new IllegalArgumentException(keys + " should have same length as " + values);
}
Map<K, V> map = newHashMap();
for (int i = 0; i < keys.size(); ++i) {
map.put(keys.get(i), values.get(i));
}
return map;
}
@NotNull
public static <K extends Comparable, V> TreeMap<K, V> newTreeMap() {
return new TreeMap<K, V>();
@@ -60,22 +73,55 @@ public class ContainerUtilRt {
return new LinkedList<T>();
}
@NotNull
public static <T> LinkedList<T> newLinkedList(T... elements) {
final LinkedList<T> list = newLinkedList();
Collections.addAll(list, elements);
return list;
}
@NotNull
public static <T> LinkedList<T> newLinkedList(@NotNull Iterable<? extends T> elements) {
return copy(ContainerUtilRt.<T>newLinkedList(), elements);
}
@NotNull
public static <T> ArrayList<T> newArrayList() {
return new ArrayList<T>();
}
@NotNull
public static <E> ArrayList<E> newArrayList(E... array) {
ArrayList<E> list = new ArrayList<E>(computeArrayListCapacity(array.length));
Collections.addAll(list, array);
public static <T> ArrayList<T> newArrayList(T... elements) {
ArrayList<T> list = newArrayListWithCapacity(elements.length);
Collections.addAll(list, elements);
return list;
}
@NotNull
public static <E> ArrayList<E> newArrayList(Iterable<? extends E> iterable) {
ArrayList<E> list = newArrayList();
for (E anIterable : iterable) {
public static <T> ArrayList<T> newArrayList(@NotNull Iterable<? extends T> elements) {
if (elements instanceof Collection) {
@SuppressWarnings("unchecked") Collection<? extends T> collection = (Collection<? extends T>)elements;
return new ArrayList<T>(collection);
}
return copy(ContainerUtilRt.<T>newArrayList(), elements);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithExpectedSize(int size) {
return new ArrayList<T>(size);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithCapacity(int size) {
return new ArrayList<T>(computeArrayListCapacity(size));
}
private static int computeArrayListCapacity(int size) {
return 5 + size + size / 5;
}
private static <T, LT extends List<T>> LT copy(LT list, @NotNull Iterable<? extends T> elements) {
for (T anIterable : elements) {
list.add(anIterable);
}
return list;
@@ -88,9 +134,7 @@ public class ContainerUtilRt {
@NotNull
public static <T> HashSet<T> newHashSet(T... elements) {
HashSet<T> set = newHashSet();
Collections.addAll(set, elements);
return set;
return new com.intellij.util.containers.HashSet<T>(Arrays.asList(elements));
}
@NotNull
@@ -105,30 +149,41 @@ public class ContainerUtilRt {
return set;
}
@NotNull
public static <T> LinkedHashSet<T> newLinkedHashSet() {
return new LinkedHashSet<T>();
}
@NotNull
public static <T> LinkedHashSet<T> newLinkedHashSet(@NotNull Collection<T> elements) {
return new LinkedHashSet<T>(elements);
}
@NotNull
public static <T> LinkedHashSet<T> newLinkedHashSet(T... elements) {
return newLinkedHashSet(Arrays.asList(elements));
}
@NotNull
public static <T> TreeSet<T> newTreeSet() {
return new TreeSet<T>();
}
@NotNull
public static <T> TreeSet<T> newTreeSet(@NotNull Collection<T> elements) {
return new TreeSet<T>(elements);
}
@NotNull
public static <T> TreeSet<T> newTreeSet(@NotNull T... elements) {
return newTreeSet(Arrays.asList(elements));
}
@NotNull
public static <T> TreeSet<T> newTreeSet(Comparator<? super T> comparator) {
return new TreeSet<T>(comparator);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithExpectedSize(int size) {
return new ArrayList<T>(size);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithCapacity(int size) {
return new ArrayList<T>(computeArrayListCapacity(size));
}
private static int computeArrayListCapacity(int size) {
return 5 + size + size / 5;
}
@NotNull
public static <T> Stack<T> newStack() {
return new Stack<T>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -17,98 +17,100 @@ package com.intellij.util.containers;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.Stack;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Stack;
/**
* @author peter
* @deprecated please use corresponding methods of {@linkplain ContainerUtil} class (to remove in IDEA 13).
*/
@SuppressWarnings("UnusedDeclaration")
public class CollectionFactory {
private CollectionFactory() {
}
private CollectionFactory() { }
@NotNull
public static <T> HashSet<T> hashSet() {
return new HashSet<T>();
return ContainerUtil.newHashSet();
}
@NotNull
public static <T> HashSet<T> hashSet(@NotNull Collection<T> elements) {
return new HashSet<T>(elements);
return ContainerUtil.newHashSet(elements);
}
@NotNull
public static <T> HashSet<T> hashSet(@NotNull T... elements) {
return hashSet(Arrays.asList(elements));
return ContainerUtil.newHashSet(elements);
}
@NotNull
public static <T> LinkedHashSet<T> linkedHashSet() {
return new LinkedHashSet<T>();
return ContainerUtil.newLinkedHashSet();
}
@NotNull
public static <T> LinkedHashSet<T> linkedHashSet(@NotNull Collection<T> elements) {
return new LinkedHashSet<T>(elements);
return ContainerUtil.newLinkedHashSet(elements);
}
@NotNull
public static <T> LinkedHashSet<T> linkedHashSet(@NotNull T... elements) {
return linkedHashSet(Arrays.asList(elements));
return ContainerUtil.newLinkedHashSet(elements);
}
@NotNull
public static <T> THashSet<T> troveSet(@NotNull T... elements) {
return troveSet(Arrays.asList(elements));
return ContainerUtil.newTroveSet(elements);
}
@NotNull
public static <T> THashSet<T> troveSet(@NotNull Collection<T> elements) {
return new THashSet<T>(elements);
return ContainerUtil.newTroveSet(elements);
}
@NotNull
public static <T> TreeSet<T> treeSet() {
return new TreeSet<T>();
return ContainerUtil.newTreeSet();
}
@NotNull
public static <T> TreeSet<T> treeSet(@NotNull Collection<T> elements) {
return new TreeSet<T>(elements);
return ContainerUtil.newTreeSet(elements);
}
@NotNull
public static <T> TreeSet<T> treeSet(@NotNull T... elements) {
return treeSet(Arrays.asList(elements));
return ContainerUtil.newTreeSet(Arrays.asList(elements));
}
@NotNull
public static <T> TreeSet<T> treeSet(@NotNull Comparator<? super T> comparator) {
return new TreeSet<T>(comparator);
return ContainerUtil.newTreeSet(comparator);
}
@NotNull
public static <T> Set<T> unmodifiableHashSet(@NotNull T... elements) {
return unmodifiableHashSet(Arrays.asList(elements));
return ContainerUtil.immutableSet(elements);
}
@NotNull
public static <T> Set<T> unmodifiableHashSet(@NotNull Collection<T> elements) {
return Collections.unmodifiableSet(hashSet(elements));
return Collections.unmodifiableSet(ContainerUtil.newHashSet(elements));
}
@NotNull
public static <K, V> HashMap<K, V> hashMap() {
return new HashMap<K, V>();
return (HashMap<K, V>)ContainerUtil.newHashMap();
}
@NotNull
public static <K, V> HashMap<K, V> hashMap(@NotNull Map<K, V> map) {
return new HashMap<K, V>(map);
return (HashMap<K, V>)ContainerUtil.newHashMap(map);
}
@NotNull
@@ -118,29 +120,27 @@ public class CollectionFactory {
@NotNull
public static <K, V> THashMap<K, V> troveMap() {
return new THashMap<K, V>();
return ContainerUtil.newTroveMap();
}
@NotNull
public static <K, V> IdentityHashMap<K, V> identityHashMap() {
return new IdentityHashMap<K, V>();
return ContainerUtil.newIdentityHashMap();
}
@NotNull
public static <K> THashSet<K> identityTroveSet() {
//noinspection unchecked
return new THashSet<K>(TObjectHashingStrategy.IDENTITY);
return ContainerUtil.newIdentityTroveSet();
}
@NotNull
public static <K> THashSet<K> identityTroveSet(int initialCapacity) {
//noinspection unchecked
return new THashSet<K>(initialCapacity, TObjectHashingStrategy.IDENTITY);
return ContainerUtil.newIdentityTroveSet(initialCapacity);
}
@NotNull
public static <K, V> LinkedHashMap<K, V> linkedHashMap() {
return new LinkedHashMap<K, V>();
return ContainerUtil.newLinkedHashMap();
}
@NotNull
@@ -154,97 +154,58 @@ public class CollectionFactory {
}
@NotNull
public static <K, V> Map<K, V> hashMap(@NotNull final List<K> keys, @NotNull final List<V> values) {
if (keys.size() != values.size()) {
throw new IllegalArgumentException(keys + " should have same length as " + values);
}
final HashMap<K, V> map = new HashMap<K, V>();
for (int i = 0; i < keys.size(); ++i) {
map.put(keys.get(i), values.get(i));
}
return map;
public static <K, V> Map<K, V> hashMap(@NotNull List<K> keys, @NotNull List<V> values) {
return ContainerUtil.newHashMap(keys, values);
}
@NotNull
public static <T> ArrayList<T> arrayList() {
return new ArrayList<T>();
return ContainerUtil.newArrayList();
}
@NotNull
public static <T> ArrayList<T> arrayList(int initialCapacity) {
return new ArrayList<T>(initialCapacity);
return ContainerUtil.newArrayListWithCapacity(initialCapacity);
}
@NotNull
public static <T> ArrayList<T> arrayList(@NotNull Collection<T> elements) {
return new ArrayList<T>(elements);
return ContainerUtil.newArrayList(elements);
}
@NotNull
public static <T> ArrayList<T> arrayList(T... elements) {
return arrayList(Arrays.asList(elements));
return ContainerUtil.newArrayList(elements);
}
@NotNull
public static <T> ArrayList<T> arrayList(@NotNull Iterable<T> elements) {
if (elements instanceof Collection) {
return arrayList((Collection<T>)elements);
}
return copy(elements, CollectionFactory.<T>arrayList());
return ContainerUtil.newArrayList(elements);
}
@NotNull
public static <T> List<T> arrayList(@NotNull final T[] elements, final int start, final int end) {
if (start < 0 || start > end || end > elements.length) throw new IllegalArgumentException("start:" + start + " end:" + end + " length:" + elements.length);
return new AbstractList<T>() {
private final int size = end - start;
@Override
public T get(final int index) {
if (index < 0 || index >= size) throw new IndexOutOfBoundsException("index:" + index + " size:" + size);
return elements[start + index];
}
@Override
public int size() {
return size;
}
};
return ContainerUtil.newArrayList(elements, start, end);
}
@NotNull
public static <T> LinkedList<T> linkedList() {
return new LinkedList<T>();
return ContainerUtil.newLinkedList();
}
@NotNull
public static <T> LinkedList<T> linkedList(@NotNull Collection<T> elements) {
return new LinkedList<T>(elements);
return ContainerUtil.newLinkedList(elements);
}
@NotNull
public static <T> LinkedList<T> linkedList(T... elements) {
return linkedList(Arrays.asList(elements));
return ContainerUtil.newLinkedList(elements);
}
@NotNull
public static <T> LinkedList<T> linkedList(@NotNull Iterable<T> elements) {
if (elements instanceof Collection) {
return linkedList((Collection<T>)elements);
}
return copy(elements, CollectionFactory.<T>linkedList());
}
@NotNull
private static <P, C extends Collection<P>> C copy(@NotNull Iterable<P> source, @NotNull C target) {
for (P e : source) {
target.add(e);
}
return target;
return ContainerUtil.newLinkedList(elements);
}
@NotNull
@@ -32,6 +32,8 @@ import java.lang.reflect.Array;
import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -39,6 +41,11 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class ContainerUtil extends ContainerUtilRt {
private static final int INSERTION_SORT_THRESHOLD = 10;
@NotNull
public static <T> T[] ar(T... elements) {
return elements;
}
@NotNull
public static <K, V> HashMap<K, V> newHashMap() {
return ContainerUtilRt.newHashMap();
@@ -49,6 +56,11 @@ public class ContainerUtil extends ContainerUtilRt {
return ContainerUtilRt.newHashMap(map);
}
@NotNull
public static <K, V> Map<K, V> newHashMap(@NotNull List<K> keys, @NotNull List<V> values) {
return ContainerUtilRt.newHashMap(keys, values);
}
@NotNull
public static <K extends Comparable, V> TreeMap<K, V> newTreeMap() {
return ContainerUtilRt.newTreeMap();
@@ -59,11 +71,31 @@ public class ContainerUtil extends ContainerUtilRt {
return ContainerUtilRt.newLinkedHashMap();
}
@NotNull
public static <K, V> THashMap<K, V> newTroveMap() {
return new THashMap<K, V>();
}
@NotNull
public static <K, V> IdentityHashMap<K, V> newIdentityHashMap() {
return new IdentityHashMap<K, V>();
}
@NotNull
public static <T> LinkedList<T> newLinkedList() {
return ContainerUtilRt.newLinkedList();
}
@NotNull
public static <T> LinkedList<T> newLinkedList(T... elements) {
return ContainerUtilRt.newLinkedList(elements);
}
@NotNull
public static <T> LinkedList<T> newLinkedList(@NotNull Iterable<? extends T> elements) {
return ContainerUtilRt.newLinkedList(elements);
}
@NotNull
public static <T> ArrayList<T> newArrayList() {
return ContainerUtilRt.newArrayList();
@@ -75,10 +107,42 @@ public class ContainerUtil extends ContainerUtilRt {
}
@NotNull
public static <E> ArrayList<E> newArrayList(Iterable<? extends E> iterable) {
public static <E> ArrayList<E> newArrayList(@NotNull Iterable<? extends E> iterable) {
return ContainerUtilRt.newArrayList(iterable);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithExpectedSize(int size) {
return ContainerUtilRt.newArrayListWithExpectedSize(size);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithCapacity(int size) {
return ContainerUtilRt.newArrayListWithCapacity(size);
}
@NotNull
public static <T> List<T> newArrayList(@NotNull final T[] elements, final int start, final int end) {
if (start < 0 || start > end || end > elements.length) {
throw new IllegalArgumentException("start:" + start + " end:" + end + " length:" + elements.length);
}
return new AbstractList<T>() {
private final int size = end - start;
@Override
public T get(final int index) {
if (index < 0 || index >= size) throw new IndexOutOfBoundsException("index:" + index + " size:" + size);
return elements[start + index];
}
@Override
public int size() {
return size;
}
};
}
@NotNull
public static <T> HashSet<T> newHashSet() {
return ContainerUtilRt.newHashSet();
@@ -99,26 +163,68 @@ public class ContainerUtil extends ContainerUtilRt {
return ContainerUtilRt.newHashSet(iterator);
}
@NotNull
public static <T> LinkedHashSet<T> newLinkedHashSet() {
return ContainerUtilRt.newLinkedHashSet();
}
@NotNull
public static <T> LinkedHashSet<T> newLinkedHashSet(@NotNull Collection<T> elements) {
return ContainerUtilRt.newLinkedHashSet(elements);
}
@NotNull
public static <T> LinkedHashSet<T> newLinkedHashSet(T... elements) {
return ContainerUtilRt.newLinkedHashSet(elements);
}
@NotNull
public static <T> THashSet<T> newTroveSet() {
return new THashSet<T>();
}
@NotNull
public static <T> THashSet<T> newTroveSet(T... elements) {
return newTroveSet(Arrays.asList(elements));
}
@NotNull
public static <T> THashSet<T> newTroveSet(@NotNull Collection<T> elements) {
return new THashSet<T>(elements);
}
@NotNull
public static <K> THashSet<K> newIdentityTroveSet() {
@SuppressWarnings("unchecked") final TObjectHashingStrategy<K> identity = TObjectHashingStrategy.IDENTITY;
return new THashSet<K>(identity);
}
@NotNull
public static <K> THashSet<K> newIdentityTroveSet(int initialCapacity) {
@SuppressWarnings("unchecked") final TObjectHashingStrategy<K> identity = TObjectHashingStrategy.IDENTITY;
return new THashSet<K>(initialCapacity, identity);
}
@NotNull
public static <T> TreeSet<T> newTreeSet() {
return ContainerUtilRt.newTreeSet();
}
@NotNull
public static <T> TreeSet<T> newTreeSet(@NotNull Collection<T> elements) {
return ContainerUtilRt.newTreeSet(elements);
}
@NotNull
public static <T> TreeSet<T> newTreeSet(@NotNull T... elements) {
return ContainerUtilRt.newTreeSet(elements);
}
@NotNull
public static <T> TreeSet<T> newTreeSet(Comparator<? super T> comparator) {
return ContainerUtilRt.newTreeSet(comparator);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithExpectedSize(int size) {
return ContainerUtilRt.newArrayListWithExpectedSize(size);
}
@NotNull
public static <T> ArrayList<T> newArrayListWithCapacity(int size) {
return ContainerUtilRt.newArrayListWithCapacity(size);
}
@NotNull
public static <K, V> ConcurrentMap<K, V> newConcurrentMap() {
return new ConcurrentHashMap<K, V>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -44,7 +44,7 @@ import com.intellij.openapi.vcs.changes.ui.RollbackProgressModifier;
import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcsUtil.RollbackUtil;
import org.jetbrains.annotations.Nullable;
@@ -168,7 +168,7 @@ public class RollbackAction extends AnAction implements DumbAware {
@Nullable
private static List<Change> getChanges(final Project project, final AnActionEvent e) {
final ChangesCheckHelper helper = new ChangesCheckHelper(project, e);
if (helper.isChangesSet() && helper.getChanges() != null) return CollectionFactory.arrayList(helper.getChanges());
if (helper.isChangesSet() && helper.getChanges() != null) return ContainerUtil.newArrayList(helper.getChanges());
final VirtualFile[] virtualFiles = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
if (virtualFiles != null && virtualFiles.length > 0) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -26,7 +26,6 @@ import com.intellij.psi.xml.XmlElement;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.refactoring.psi.PropertyUtils;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.LinkedMultiMap;
import com.intellij.util.containers.MultiMap;
@@ -100,7 +99,7 @@ public class ExtensionDomExtender extends DomExtender<Extensions> {
}
private static Set<IdeaPlugin> getVisiblePlugins(IdeaPlugin ideaPlugin) {
Set<IdeaPlugin> result = CollectionFactory.hashSet();
Set<IdeaPlugin> result = ContainerUtil.newHashSet();
MultiMap<String, IdeaPlugin> byId = getPluginMap(ideaPlugin.getManager().getProject());
collectDependencies(ideaPlugin, result, byId);
//noinspection NullableProblems
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -17,7 +17,7 @@
package org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess;
import com.intellij.psi.*;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.annotator.GrHighlightUtil;
@@ -111,7 +111,7 @@ public class GroovyUnresolvedAccessInspection extends BaseInspection {
boolean gpp = GppTypeConverter.hasTypedContext(target) && GppTypeConverter.hasTypedContext(refExpr);
if (refExpr.getParent() instanceof GrCall) {
List<PsiMethod> toSearch =
CollectionFactory.arrayList(target.findMethodsByName(gpp ? "invokeUnresolvedMethod" : "invokeMethod", true));
ContainerUtil.newArrayList(target.findMethodsByName(gpp ? "invokeUnresolvedMethod" : "invokeMethod", true));
for (Iterator<PsiMethod> iterator = toSearch.iterator(); iterator.hasNext(); ) {
PsiMethod method = iterator.next();
if (!gpp &&
@@ -124,7 +124,7 @@ public class GroovyUnresolvedAccessInspection extends BaseInspection {
}
if (PsiUtil.isLValue(refExpr)) {
List<PsiMethod> toSearch = CollectionFactory.arrayList(target.findMethodsByName(gpp ? "setUnresolvedProperty" : "setProperty", true));
List<PsiMethod> toSearch = ContainerUtil.newArrayList(target.findMethodsByName(gpp ? "setUnresolvedProperty" : "setProperty", true));
for (Iterator<PsiMethod> iterator = toSearch.iterator(); iterator.hasNext(); ) {
PsiMethod method = iterator.next();
if (method.getParameterList().getParametersCount() != 2 || (!gpp && !method.getParameterList().getParameters()[1].getType()
@@ -135,7 +135,7 @@ public class GroovyUnresolvedAccessInspection extends BaseInspection {
return toSearch;
}
List<PsiMethod> toSearch = CollectionFactory.arrayList(target.findMethodsByName(gpp ? "getUnresolvedProperty" : "getProperty", true));
List<PsiMethod> toSearch = ContainerUtil.newArrayList(target.findMethodsByName(gpp ? "getUnresolvedProperty" : "getProperty", true));
for (Iterator<PsiMethod> iterator = toSearch.iterator(); iterator.hasNext(); ) {
if (iterator.next().getParameterList().getParametersCount() != 1) {
iterator.remove();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -47,7 +47,6 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.Chunk;
import com.intellij.util.Processor;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.FactoryMap;
import org.jetbrains.annotations.NotNull;
@@ -253,7 +252,7 @@ public class GroovycStubGenerator extends GroovyCompilerBase {
}
private static List<VirtualFile> writeStubs(VirtualFile outputRootDirectory, Map<String, CharSequence> output, VirtualFile src) {
final ArrayList<VirtualFile> stubs = CollectionFactory.arrayList();
final ArrayList<VirtualFile> stubs = ContainerUtil.newArrayList();
for (String relativePath : output.keySet()) {
final File stubFile = new File(outputRootDirectory.getPath(), relativePath);
FileUtil.createIfDoesntExist(stubFile);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashSet;
import gnu.trove.TObjectIntHashMap;
@@ -351,7 +350,7 @@ public class GroovyImportOptimizer implements ImportOptimizer {
}
});
List<GrImportStatement> explicated = CollectionFactory.arrayList();
List<GrImportStatement> explicated = ContainerUtil.newArrayList();
for (String importedClass : importedClasses) {
final String parentName = StringUtil.getPackageName(importedClass);
if (!annotations.containsKey(importedClass) && !aliased.containsKey(importedClass)) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -36,7 +36,6 @@ import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.reference.SoftReference;
import com.intellij.util.PathUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.lang.UrlClassLoader;
import org.jetbrains.annotations.NotNull;
@@ -126,7 +125,7 @@ public class AntTasksProvider {
final Map<List<URL>, SoftReference<AntClassLoader>> map = CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider<Map<List<URL>, SoftReference<AntClassLoader>>>() {
@Override
public Result<Map<List<URL>, SoftReference<AntClassLoader>>> compute() {
final Map<List<URL>, SoftReference<AntClassLoader>> map = CollectionFactory.hashMap();
final Map<List<URL>, SoftReference<AntClassLoader>> map = ContainerUtil.newHashMap();
return Result.create(map, ProjectRootManager.getInstance(project));
}
});
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -36,7 +36,7 @@ import org.jetbrains.plugins.groovy.util.LibrariesUtil;
import java.io.File;
import static com.intellij.util.containers.CollectionFactory.ar;
import static com.intellij.util.containers.ContainerUtil.ar;
/**
* @author ilyas
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 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.
*/
package org.jetbrains.plugins.groovy.gpp;
import com.intellij.openapi.util.Pair;
@@ -6,7 +21,7 @@ import com.intellij.psi.*;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap;
@@ -94,10 +109,10 @@ public class GppReferenceContributor extends PsiReferenceContributor {
private List<ResolveResult> addMethodCandidates(PsiClassType classType, GrExpression value) {
PsiType valueType = value == null ? null : value.getType();
final List<ResolveResult> applicable = CollectionFactory.arrayList();
final List<ResolveResult> applicable = ContainerUtil.newArrayList();
if (value == null || GroovyPsiManager.isInheritorCached(valueType, GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) {
final List<ResolveResult> byName = CollectionFactory.arrayList();
final List<ResolveResult> byName = ContainerUtil.newArrayList();
for (Pair<PsiMethod, PsiSubstitutor> variant : GppClosureParameterTypeProvider.getMethodsToOverrideImplementInInheritor(classType, false)) {
final PsiMethod method = variant.first;
if (getValue().equals(method.getName())) {
@@ -57,7 +57,6 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiRecursiveElementWalkingVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.*;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
@@ -260,7 +259,7 @@ public class GrabDependencies implements IntentionAction {
if (jarRoot != null) {
OrderRootType rootType = OrderRootType.CLASSES;
String libName = "Grab:" + jar.getName();
for (String classifier : CollectionFactory.ar("sources", "source", "src")) {
for (String classifier : ContainerUtil.ar("sources", "source", "src")) {
if (libName.endsWith("-" + classifier + ".jar")) {
rootType = OrderRootType.SOURCES;
libName = StringUtil.trimEnd(libName, "-" + classifier + ".jar") + ".jar";
@@ -79,7 +79,7 @@ import java.util.Set;
import static com.intellij.patterns.PlatformPatterns.psiElement;
import static com.intellij.patterns.PsiJavaPatterns.elementType;
import static com.intellij.util.containers.CollectionFactory.*;
import static com.intellij.util.containers.ContainerUtil.*;
import static org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes.*;
import static org.jetbrains.plugins.groovy.lang.lexer.TokenSets.SEPARATORS;
import static org.jetbrains.plugins.groovy.lang.lexer.TokenSets.WHITE_SPACES_OR_COMMENTS;
@@ -404,7 +404,7 @@ public class GroovyCompletionContributor extends CompletionContributor {
static Runnable completeReference(final CompletionParameters parameters,
GrReferenceElement reference, final InheritorsHolder inheritorsHolder, final PrefixMatcher matcher, final Consumer<LookupElement> _consumer) {
final Consumer<LookupElement> consumer = new Consumer<LookupElement>() {
final Set<LookupElement> added = hashSet();
final Set<LookupElement> added = newHashSet();
@Override
public void consume(LookupElement element) {
if (added.add(element)) {
@@ -413,7 +413,7 @@ public class GroovyCompletionContributor extends CompletionContributor {
}
};
final Map<PsiModifierListOwner, LookupElement> staticMembers = hashMap();
final Map<PsiModifierListOwner, LookupElement> staticMembers = newHashMap();
final PsiElement qualifier = reference.getQualifier();
final PsiType qualifierType = qualifier instanceof GrExpression ? ((GrExpression)qualifier).getType() : null;
@@ -435,7 +435,7 @@ public class GroovyCompletionContributor extends CompletionContributor {
unresolvedProps = Collections.emptySet();
}
final List<LookupElement> zeroPriority = arrayList();
final List<LookupElement> zeroPriority = newArrayList();
reference.processVariants(matcher, parameters, new Consumer<LookupElement>() {
public void consume(LookupElement lookupElement) {
Object object = lookupElement.getObject();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -42,7 +42,7 @@ import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.*;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.CharArrayUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -229,7 +229,7 @@ public class GroovyCompletionUtil {
boolean afterNew,
PrefixMatcher matcher,
PsiElement position) {
List<LookupElement> result = CollectionFactory.arrayList();
List<LookupElement> result = ContainerUtil.newArrayList();
for (GroovyResolveResult candidate : candidates) {
result.addAll(createLookupElements(candidate, afterNew, matcher, position));
ProgressManager.checkCanceled();
@@ -482,11 +482,11 @@ public class GroovyCompletionUtil {
return TailType.insertChar(editor, offset, ')');
}
public static final Set<String> OPERATOR_METHOD_NAMES = CollectionFactory.hashSet(
public static final Set<String> OPERATOR_METHOD_NAMES = ContainerUtil.newHashSet(
"plus", "minus", "multiply", "power", "div", "mod", "or", "and", "xor", "next", "previous", "getAt", "putAt", "leftShift", "rightShift",
"isCase", "bitwiseNegate", "negative", "positive", "call"
);
public static boolean skipDefGroovyMethod(GrGdkMethod gdkMethod, PsiSubstitutor substitutor, @Nullable PsiType type) {
if (type == null) return false;
String name = gdkMethod.getStaticMethod().getName();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -24,7 +24,7 @@ import com.intellij.psi.impl.light.LightElement;
import com.intellij.psi.impl.source.tree.java.PsiAnnotationImpl;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor;
@@ -46,7 +46,7 @@ import java.util.Set;
*/
public class GrKindWeigher extends CompletionWeigher {
private static final Set<String> TRASH_CLASSES = new HashSet<String>(10);
private static final Set<String> PRIORITY_KEYWORDS = CollectionFactory.hashSet(
private static final Set<String> PRIORITY_KEYWORDS = ContainerUtil.newHashSet(
PsiKeyword.RETURN, PsiKeyword.INSTANCEOF, "in",
PsiKeyword.PRIVATE, PsiKeyword.PROTECTED, PsiKeyword.PUBLIC, PsiKeyword.STATIC, "def",
PsiKeyword.TRUE, PsiKeyword.FALSE, PsiKeyword.NULL);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -25,7 +25,7 @@ import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
@@ -79,7 +79,7 @@ public class GrStubUtils {
}
public static String[] getAnnotationNames(PsiModifierListOwner psi) {
List<String> annoNames = CollectionFactory.arrayList();
List<String> annoNames = ContainerUtil.newArrayList();
final PsiModifierList modifierList = psi.getModifierList();
if (modifierList instanceof GrModifierList) {
for (GrAnnotation annotation : ((GrModifierList)modifierList).getAnnotations()) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -19,7 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.scope.DelegatingScopeProcessor;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -44,7 +44,7 @@ public class GdkMethodUtil {
private static final Logger LOG = Logger.getInstance(GdkMethodUtil.class);
public static final Set<String> COLLECTION_METHOD_NAMES = CollectionFactory.hashSet(
public static final Set<String> COLLECTION_METHOD_NAMES = ContainerUtil.newHashSet(
"each", "eachWithIndex", "any", "every", "reverseEach", "collect", "collectAll", "find", "findAll", "retainAll", "removeAll", "split",
"groupBy", "groupEntriesBy", "findLastIndexOf", "findIndexValues", "findIndexOf"
);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -28,7 +28,6 @@ import com.intellij.psi.stubs.StubIndexImpl;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ObjectUtils;
import com.intellij.util.Processor;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashSet;
import org.jetbrains.annotations.NonNls;
@@ -109,7 +108,7 @@ public class GroovyShortNamesCache extends PsiShortNamesCache {
}
private Collection<PsiClass> getAllScriptClasses(String shortName, GlobalSearchScope scope) {
final ArrayList<PsiClass> result = CollectionFactory.arrayList();
final ArrayList<PsiClass> result = ContainerUtil.newArrayList();
for (GroovyFile file : StubIndex.getInstance().get(GrScriptClassNameIndex.KEY, shortName, myProject, new GrSourceFilterScope(scope))) {
ContainerUtil.addIfNotNull(file.getScriptClass(), result);
}
@@ -44,7 +44,6 @@ import com.intellij.util.ArrayUtil;
import com.intellij.util.CommonProcessors;
import com.intellij.util.Consumer;
import com.intellij.util.SmartList;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NonNls;
@@ -92,7 +91,7 @@ public class MvcModuleStructureUtil {
root.refresh(false, true);
final List<Consumer<ContentEntry>> actions = CollectionFactory.arrayList();
final List<Consumer<ContentEntry>> actions = ContainerUtil.newArrayList();
for (final String src : structure.getSourceFolders()) {
addSourceFolder(root, src, false, actions, sourceRoots);
@@ -269,7 +268,7 @@ public class MvcModuleStructureUtil {
appRoot.refresh(false, false);
}
List<Consumer<ModifiableRootModel>> actions = CollectionFactory.arrayList();
List<Consumer<ModifiableRootModel>> actions = ContainerUtil.newArrayList();
removeInvalidSourceRoots(actions, structure);
cleanupDefaultLibrary(structure.myModule, actions, appRoots, structure.getUserLibraryName());
moveupLibrariesFromMavenPlugin(structure.myModule, actions);
@@ -336,8 +335,8 @@ public class MvcModuleStructureUtil {
}
private static void removeInvalidSourceRoots(List<Consumer<ModifiableRootModel>> actions, MvcProjectStructure structure) {
final Set<SourceFolder> toRemove = CollectionFactory.troveSet();
final Set<ContentEntry> toRemoveContent = CollectionFactory.troveSet();
final Set<SourceFolder> toRemove = ContainerUtil.newTroveSet();
final Set<ContentEntry> toRemoveContent = ContainerUtil.newTroveSet();
for (ContentEntry entry : ModuleRootManager.getInstance(structure.myModule).getContentEntries()) {
final VirtualFile file = entry.getFile();
if (file == null || !structure.isValidContentRoot(file)) {
@@ -1,10 +1,25 @@
/*
* Copyright 2000-2012 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.
*/
package org.jetbrains.plugins.groovy.mvc;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import java.util.Set;
@@ -16,7 +31,7 @@ public class MvcPathMacros {
public MvcPathMacros() {
Set<String> macroNames = PathMacros.getInstance().getUserMacroNames();
for (String framework : CollectionFactory.ar("grails", "griffon")) {
for (String framework : ContainerUtil.ar("grails", "griffon")) {
String name = "USER_HOME_" + framework.toUpperCase();
if (!macroNames.contains(name)) { // OK, it may appear/disappear during the application lifetime, but we ignore that for now. Restart will help anyway
PathMacros.getInstance().addLegacyMacro(name, StringUtil.trimEnd(getSdkWorkDirParent(framework), "/"));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -26,7 +26,7 @@ import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
@@ -167,7 +167,7 @@ public class StubGenerator implements ClassItemGenerator {
return Collections.emptySet();
}
final Set<String> result = CollectionFactory.troveSet(ArrayUtil.EMPTY_STRING_ARRAY);
final Set<String> result = ContainerUtil.newTroveSet(ArrayUtil.EMPTY_STRING_ARRAY);
for (PsiClassType type : chainedConstructor.getThrowsList().getReferencedTypes()) {
StringBuilder builder = new StringBuilder();
writeType(builder, substitutor.substitute(type), constructor, classNameProvider);
@@ -1,3 +1,18 @@
/*
* Copyright 2000-2012 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.
*/
package org.jetbrains.plugins.groovy.spock
import com.intellij.codeInsight.lookup.LookupElement
@@ -5,7 +20,7 @@ import com.intellij.psi.CommonClassNames
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiVariable
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import com.intellij.util.containers.CollectionFactory
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUnresolvedAccessInspection
@@ -190,7 +205,7 @@ class FooSpec extends spock.lang.Specification {
assertNotNull(lookupElements);
Set<String> missedVariants = CollectionFactory.hashSet(expectedVariants);
Set<String> missedVariants = ContainerUtil.newHashSet(expectedVariants);
for (LookupElement lookupElement : lookupElements) {
missedVariants.remove(lookupElement.getLookupString());
@@ -1,5 +1,6 @@
/*
* Copyright 2000-2008 JetBrains s.r.o.
* Copyright 2000-2012 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
@@ -25,7 +26,7 @@ import com.intellij.psi.*;
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.LocalTimeCounter;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor;
import org.junit.Assert;
@@ -154,7 +155,7 @@ public abstract class TestUtils {
Assert.assertNotNull(lookupElements);
Set<String> missedVariants = CollectionFactory.hashSet(expectedVariants);
Set<String> missedVariants = ContainerUtil.newHashSet(expectedVariants);
for (LookupElement lookupElement : lookupElements) {
String lookupString = lookupElement.getLookupString();
@@ -33,7 +33,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.testFramework.LightVirtualFile;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import org.jdom.Element;
@@ -56,7 +56,7 @@ import java.util.regex.Pattern;
public class MavenResourceCompiler implements ClassPostProcessingCompiler {
private static final Key<List<String>> FILES_TO_DELETE_KEY = Key.create(MavenResourceCompiler.class.getSimpleName() + ".FILES_TO_DELETE");
private static final Set<String> DEFAULT_NON_FILTERED_EXTENSIONS = CollectionFactory.hashSet("jpg", "jpeg", "gif", "bmp", "png");
private static final Set<String> DEFAULT_NON_FILTERED_EXTENSIONS = ContainerUtil.newHashSet("jpg", "jpeg", "gif", "bmp", "png");
private Map<String, Set<String>> myOutputItemsCache = new THashMap<String, Set<String>>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -37,7 +37,7 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.XmlElement;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xml.*;
import com.intellij.util.xml.reflect.DomCollectionChildDescription;
import org.jetbrains.annotations.NotNull;
@@ -59,7 +59,7 @@ import java.util.regex.Pattern;
public class MavenDomUtil {
// see http://maven.apache.org/settings.html
private static final Set<String> SUBTAGS_IN_SETTINGS_FILE = CollectionFactory.hashSet("localRepository", "interactiveMode",
private static final Set<String> SUBTAGS_IN_SETTINGS_FILE = ContainerUtil.newHashSet("localRepository", "interactiveMode",
"usePluginRegistry", "offline", "pluginGroups",
"servers", "mirrors", "proxies", "profiles",
"activeProfiles");
@@ -34,7 +34,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Key;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.project.MavenProject;
@@ -51,7 +51,7 @@ public class MavenResumeAction extends AnAction {
private static final Logger LOG = Logger.getInstance(MavenResumeAction.class);
private static final Set<String> PARAMS_DISABLING_RESUME = CollectionFactory.hashSet("-rf", "-resume-from", "-pl", "-projects", "-am",
private static final Set<String> PARAMS_DISABLING_RESUME = ContainerUtil.newHashSet("-rf", "-resume-from", "-pl", "-projects", "-am",
"-also-make", "-amd", "-also-make-dependents");
public static final int STATE_INITIAL = 0;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -29,7 +29,6 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.SmartList;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jdom.Element;
@@ -744,7 +743,7 @@ public class MavenProject {
@NotNull
public Set<String> getSupportedPackagings() {
Set<String> result = CollectionFactory.hashSet(MavenConstants.TYPE_POM,
Set<String> result = ContainerUtil.newHashSet(MavenConstants.TYPE_POM,
MavenConstants.TYPE_JAR,
"ejb", "ejb-client", "war", "ear", "bundle", "maven-plugin");
for (MavenImporter each : getSuitableImporters()) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -16,7 +16,7 @@
package com.intellij.util.xml.impl;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xml.EvaluatedXmlName;
import java.lang.reflect.Type;
@@ -37,7 +37,7 @@ class AddToCompositeCollectionInvocation implements Invocation {
}
public Object invoke(final DomInvocationHandler<?, ?> handler, final Object[] args) throws Throwable {
Set<XmlTag> set = CollectionFactory.troveSet();
Set<XmlTag> set = ContainerUtil.newTroveSet();
for (final CollectionChildDescriptionImpl qname : myQnames) {
set.addAll(qname.getTagsGetter().fun(handler));
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -35,7 +35,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static com.intellij.util.containers.CollectionFactory.arrayList;
import static com.intellij.util.containers.ContainerUtil.newArrayList;
/**
* @author peter
@@ -114,7 +114,7 @@ public class DomApplicationComponent {
}
public synchronized List<DomFileDescription> getAllFileDescriptions() {
final List<DomFileDescription> result = arrayList();
final List<DomFileDescription> result = newArrayList();
for (Set<DomFileDescription> descriptions : myRootTagName2FileDescription.values()) {
result.addAll(descriptions);
}
@@ -30,7 +30,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.xml.Html5SchemaProvider;
import com.intellij.xml.XmlSchemaProvider;
@@ -125,7 +125,7 @@ public class ExternalResourceManagerImpl extends ExternalResourceManagerEx imple
Map<String, T> map = resources.get(version);
if (map == null) {
if (create) {
map = CollectionFactory.hashMap();
map = ContainerUtil.newHashMap();
resources.put(version, map);
}
else if (version == null || !version.equals(DEFAULT_VERSION)) {