当前位置: 首页>>代码示例>>Java>>正文


Java LinkedHashMap类代码示例

本文整理汇总了Java中com.intellij.util.containers.hash.LinkedHashMap的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashMap类的具体用法?Java LinkedHashMap怎么用?Java LinkedHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LinkedHashMap类属于com.intellij.util.containers.hash包,在下文中一共展示了LinkedHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runInspectionTool

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
private static Map<ProblemDescriptor, HighlightDisplayLevel> runInspectionTool(final PsiFile file,
                                                                               final LocalInspectionTool inspectionTool,
                                                                               final HighlightDisplayLevel level) {
  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (ProblemDescriptor descriptor : runInspectionOnFile(file, inspectionTool)) {
    final ProblemHighlightType highlightType = descriptor.getHighlightType();

    final HighlightDisplayLevel highlightDisplayLevel;
    if (highlightType == ProblemHighlightType.WEAK_WARNING) {
      highlightDisplayLevel = HighlightDisplayLevel.WEAK_WARNING;
    }
    else if (highlightType == ProblemHighlightType.INFORMATION) {
      highlightDisplayLevel = HighlightDisplayLevel.DO_NOT_SHOW;
    }
    else {
      highlightDisplayLevel = level;
    }
    problemsMap.put(descriptor, highlightDisplayLevel);
  }
  return problemsMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InspectionValidatorWrapper.java

示例2: StorageLock

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public StorageLock(boolean checkThreadAccess) {
  myDefaultStorageLockContext = new StorageLockContext(this, checkThreadAccess);

  mySizeLimit = UPPER_LIMIT;
  mySegments = new LinkedHashMap<Integer, ByteBufferWrapper>(10, 0.75f, true) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<Integer, ByteBufferWrapper> eldest) {
      return mySize > mySizeLimit;
    }

    @Nullable
    @Override
    public ByteBufferWrapper remove(Object key) {
      // this method can be called after removeEldestEntry
      ByteBufferWrapper wrapper = super.remove(key);
      if (wrapper != null) {
        ++myMappingChangeCount;
        mySegmentsToRemove.offer(wrapper);
        mySize -= wrapper.myLength;
      }
      return wrapper;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PagedFileStorage.java

示例3: PagePool

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public PagePool(final int protectedPagesLimit, final int probationalPagesLimit) {
  myProbationalQueue = new LinkedHashMap<PoolPageKey,Page>(probationalPagesLimit * 2, 1, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > probationalPagesLimit) {
        scheduleFinalization(eldest.getValue());
        return true;
      }
      return false;
    }
  };

  myProtectedQueue = new LinkedHashMap<PoolPageKey, Page>(protectedPagesLimit, 1, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > protectedPagesLimit) {
        myProbationalQueue.put(eldest.getKey(), eldest.getValue());
        return true;
      }
      return false;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PagePool.java

示例4: SLRUMap

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public SLRUMap(final int protectedQueueSize, final int probationalQueueSize, EqualityPolicy hashingStrategy) {
  myProtectedQueueSize = protectedQueueSize * FACTOR;
  myProbationalQueueSize = probationalQueueSize * FACTOR;

  myProtectedQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProtectedQueueSize) {
        myProbationalQueue.put(key, value);
        return true;
      }

      return false;
    }
  };

  myProbationalQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) {
    protected boolean removeEldestEntry(final Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProbationalQueueSize) {
        onDropFromCache(key, value);
        return true;
      }
      return false;
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:SLRUMap.java

示例5: StorageLock

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public StorageLock(boolean checkThreadAccess) {
  myDefaultStorageLockContext = new StorageLockContext(this, checkThreadAccess);

  mySizeLimit = UPPER_LIMIT;
  mySegments = new LinkedHashMap<Integer, ByteBufferWrapper>(10, 0.75f) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<Integer, ByteBufferWrapper> eldest) {
      return mySize > mySizeLimit;
    }

    @Nullable
    @Override
    public ByteBufferWrapper remove(Object key) {
      // this method can be called after removeEldestEntry
      ByteBufferWrapper wrapper = super.remove(key);
      if (wrapper != null) {
        ++myMappingChangeCount;
        mySegmentsToRemove.offer(wrapper);
        mySize -= wrapper.myLength;
      }
      return wrapper;
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:PagedFileStorage.java

示例6: PagePool

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public PagePool(final int protectedPagesLimit, final int probationalPagesLimit) {
  myProbationalQueue = new LinkedHashMap<PoolPageKey,Page>(probationalPagesLimit * 2, 0.6f) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > probationalPagesLimit) {
        scheduleFinalization(eldest.getValue());
        return true;
      }
      return false;
    }
  };

  myProtectedQueue = new LinkedHashMap<PoolPageKey, Page>(protectedPagesLimit, 0.6f) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) {
      if (size() > protectedPagesLimit) {
        myProbationalQueue.put(eldest.getKey(), eldest.getValue());
        return true;
      }
      return false;
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:PagePool.java

示例7: getConfiguredAnts

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
@NotNull
public Map<AntReference, Sdk> getConfiguredAnts()
{
	List<Sdk> sdksOfType = SdkTable.getInstance().getSdksOfType(AntSdkType.getInstance());
	Map<AntReference, Sdk> map = new LinkedHashMap<AntReference, Sdk>();
	for(Sdk sdk : sdksOfType)
	{
		if(sdk.isPredefined())
		{
			map.put(AntReference.BUNDLED_ANT, sdk);
		}
		else
		{
			map.put(new AntReference.BindedReference(sdk), sdk);
		}
	}
	return map;
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:19,代码来源:GlobalAntConfiguration.java

示例8: prefixReplaced

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public final void prefixReplaced(Lookup lookup, String newPrefix) {
  //noinspection unchecked
  Map<LookupElement, PrefixMatcher> newMatchers = new LinkedHashMap(EqualityPolicy.IDENTITY);
  for (LookupElement item : myItems) {
    if (item.isValid()) {
      PrefixMatcher matcher = itemMatcher(item).cloneWithPrefix(newPrefix);
      if (matcher.prefixMatches(item)) {
        newMatchers.put(item, matcher);
      }
    }
  }
  myMatchers.clear();
  myMatchers.putAll(newMatchers);
  myItems.clear();
  myItems.addAll(newMatchers.keySet());

  prefixChanged(lookup);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:LookupArranger.java

示例9: runXmlFileSchemaValidation

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
  final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));

  final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
  for (ExternalAnnotator<?, ?> annotator : annotators) {
    processAnnotator(xmlFile, holder, annotator);
  }

  if (!holder.hasAnnotations()) return Collections.emptyMap();

  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (final Annotation annotation : holder) {
    final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
    if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;

    final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
    final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
    if (startElement == null || endElement == null) continue;

    final ProblemDescriptor descriptor =
      myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                  false);
    final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
    problemsMap.put(descriptor, level);
  }
  return problemsMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:InspectionValidatorWrapper.java

示例10: getHyperlinks

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
@Deprecated
public Map<RangeHighlighter, HyperlinkInfo> getHyperlinks() {
  LinkedHashMap<RangeHighlighter, HyperlinkInfo> result = new LinkedHashMap<RangeHighlighter, HyperlinkInfo>();
  for (RangeHighlighter highlighter : getHyperlinks(0, myEditor.getDocument().getTextLength(), myEditor)) {
    HyperlinkInfo info = getHyperlinkInfo(highlighter);
    if (info != null) {
      result.put(highlighter, info);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:EditorHyperlinkSupport.java

示例11: createDescriptors

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
protected static Map<GroupDescriptor, Set<UsageDescriptor>> createDescriptors(String... strs) {
    Map<GroupDescriptor, Set<UsageDescriptor>> set = new LinkedHashMap<GroupDescriptor, Set<UsageDescriptor>>();
    for (String str : strs) {
        final List<String> list = StringUtil.split(str, ":");
        final GroupDescriptor g = GroupDescriptor.create(list.get(0));
        if (!set.containsKey(g)) {
            set.put(g, new LinkedHashSet<UsageDescriptor>());
        }
        set.get(g).add(createDescriptor(list.get(1), Integer.parseInt(list.get(2))));
    }

    return set;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:StatisticsUploadAssistantTest.java

示例12: SLRUMap

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
public SLRUMap(final int protectedQueueSize, final int probationalQueueSize, EqualityPolicy hashingStrategy) {
  myProtectedQueueSize = protectedQueueSize * FACTOR;
  myProbationalQueueSize = probationalQueueSize * FACTOR;

  myProtectedQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy, true) {
    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProtectedQueueSize) {
        myProbationalQueue.put(key, value);
        return true;
      }

      return false;
    }
  };

  myProbationalQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy, true) {
    @Override
    protected boolean removeEldestEntry(final Map.Entry<K, V> eldest, K key, V value) {
      if (size() > myProbationalQueueSize) {
        onDropFromCache(key, value);
        return true;
      }
      return false;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SLRUMap.java

示例13: checkMapping

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
@NotNull
private Map<PyExpression, Pair<String, ProblemHighlightType>> checkMapping(@Nullable PyExpression receiver,
                                                                           @NotNull Map<PyExpression, PyNamedParameter> mapping) {
  final Map<PyExpression, Pair<String, ProblemHighlightType>> problems = new HashMap<PyExpression, Pair<String, ProblemHighlightType>>();
  final Map<PyGenericType, PyType> substitutions = new LinkedHashMap<PyGenericType, PyType>();
  boolean genericsCollected = false;
  for (Map.Entry<PyExpression, PyNamedParameter> entry : mapping.entrySet()) {
    final PyNamedParameter param = entry.getValue();
    final PyExpression arg = entry.getKey();
    if (param.isPositionalContainer() || param.isKeywordContainer()) {
      continue;
    }
    final PyType paramType = myTypeEvalContext.getType(param);
    if (paramType == null) {
      continue;
    }
    final PyType argType = myTypeEvalContext.getType(arg);
    if (!genericsCollected) {
      substitutions.putAll(PyTypeChecker.unifyReceiver(receiver, myTypeEvalContext));
      genericsCollected = true;
    }
    final Pair<String, ProblemHighlightType> problem = checkTypes(paramType, argType, myTypeEvalContext, substitutions);
    if (problem != null) {
      problems.put(arg, problem);

    }
  }
  return problems;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PyTypeCheckerInspection.java

示例14: prepareMultiRepoTooltip

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
private void prepareMultiRepoTooltip(StringBand infoPart, Collection<GitRepository> repositories) {
  PerRepoInfoCache cache = PerRepoInfoCache.getInstance(project);
  Map<GitRepository, String> statuses = new LinkedHashMap<>();
  final AtomicReference<GitRepository> currentRepo = new AtomicReference<>();
  for (GitRepository repository : GtUtil.sort(repositories)) {
    cache.getInfo(repository).count().map(StatusText::format).ifPresent(statusText -> {
      if (repository.equals(currentRepository)) {
        currentRepo.set(repository);
      }
      statuses.put(repository, statusText);
    });
  }
  if (!statuses.isEmpty()) {
    if (infoPart.length() > 0) {
      infoPart.append(Html.HR);
    }
    infoPart.append(
        statuses.entrySet().stream().map(e -> {
          String repoStatus = GitUIUtil.bold(GtUtil.name(e.getKey())) + ": " + e.getValue();
          if (Objects.equals(e.getKey(), currentRepo.get())) {
            repoStatus = Html.underline(repoStatus);
          }
          return repoStatus;
        }).collect(Collectors.joining(Html.BR))
    );
  }
}
 
开发者ID:zielu,项目名称:GitToolBox,代码行数:28,代码来源:StatusToolTip.java

示例15: runInspectionTool

import com.intellij.util.containers.hash.LinkedHashMap; //导入依赖的package包/类
private static Map<ProblemDescriptor, HighlightDisplayLevel> runInspectionTool(final PsiFile file,
                                                                               final LocalInspectionTool inspectionTool,
                                                                               final HighlightDisplayLevel level) {
  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (ProblemDescriptor descriptor : InspectionRunningUtil.runInspectionOnFile(file, inspectionTool)) {
    problemsMap.put(descriptor, level);
  }
  return problemsMap;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:InspectionValidatorWrapper.java


注:本文中的com.intellij.util.containers.hash.LinkedHashMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。