本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.newIdentityHashMap方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.newIdentityHashMap方法的具體用法?Java ContainerUtil.newIdentityHashMap怎麽用?Java ContainerUtil.newIdentityHashMap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.newIdentityHashMap方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convertToProblemDescriptors
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
private static ProblemDescriptor[] convertToProblemDescriptors(@NotNull final List<Annotation> annotations,
@NotNull final InspectionManager manager,
@NotNull final PsiFile file) {
if (annotations.isEmpty()) {
return ProblemDescriptor.EMPTY_ARRAY;
}
List<ProblemDescriptor> problems = ContainerUtil.newArrayListWithCapacity(annotations.size());
IdentityHashMap<IntentionAction, LocalQuickFix> quickFixMappingCache = ContainerUtil.newIdentityHashMap();
for (Annotation annotation : annotations) {
if (annotation.getSeverity() == HighlightSeverity.INFORMATION ||
annotation.getStartOffset() == annotation.getEndOffset()) {
continue;
}
final PsiElement startElement = file.findElementAt(annotation.getStartOffset());
final PsiElement endElement = file.findElementAt(annotation.getEndOffset() - 1);
if (startElement == null || endElement == null) {
continue;
}
LocalQuickFix[] quickFixes = toLocalQuickFixes(annotation.getQuickFixes(), quickFixMappingCache);
ProblemDescriptor descriptor = manager.createProblemDescriptor(startElement,
endElement,
annotation.getMessage(),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
false,
quickFixes);
problems.add(descriptor);
}
return problems.toArray(new ProblemDescriptor[problems.size()]);
}