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


Java TObjectHashingStrategy.IDENTITY属性代码示例

本文整理汇总了Java中gnu.trove.TObjectHashingStrategy.IDENTITY属性的典型用法代码示例。如果您正苦于以下问题:Java TObjectHashingStrategy.IDENTITY属性的具体用法?Java TObjectHashingStrategy.IDENTITY怎么用?Java TObjectHashingStrategy.IDENTITY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在gnu.trove.TObjectHashingStrategy的用法示例。


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

示例1: testKeysRemovedWhenIdentityStrategyIsUsed

@Test(timeout = TIMEOUT)
public void testKeysRemovedWhenIdentityStrategyIsUsed() {
  @SuppressWarnings("unchecked") ConcurrentWeakHashMap<Object, Object> map = new ConcurrentWeakHashMap<Object, Object>(TObjectHashingStrategy.IDENTITY);
  map.put(new Object(), new Object());

  do {
    tryGcSoftlyReachableObjects(); // sometimes weak references are not collected under linux, try to stress gc to force them
    System.gc();
  }
  while (!map.processQueue());
  map.put(this, this);
  assertEquals(1, map.underlyingMapSize());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ConcurrentMapsTest.java

示例2: classify

@Override
public Iterable<LookupElement> classify(Iterable<LookupElement> source, final ProcessingContext context) {
  checkPrefixChanged(context);

  final Collection<List<LookupElement>> byWeight = buildMapByWeight(source, context).descendingMap().values();

  List<LookupElement> initialList = getInitialNoStatElements(source, context);

  //noinspection unchecked
  final THashSet<LookupElement> initialSet = new THashSet<LookupElement>(initialList, TObjectHashingStrategy.IDENTITY);
  final Condition<LookupElement> notInInitialList = new Condition<LookupElement>() {
    @Override
    public boolean value(LookupElement element) {
      return !initialSet.contains(element);
    }
  };

  return ContainerUtil.concat(initialList, new Iterable<LookupElement>() {
    @Override
    public Iterator<LookupElement> iterator() {
      return new FlatteningIterator<List<LookupElement>, LookupElement>(byWeight.iterator()) {
        @Override
        protected Iterator<LookupElement> createValueIterator(List<LookupElement> group) {
          return myNext.classify(ContainerUtil.findAll(group, notInInitialList), context).iterator();
        }
      };
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:StatisticsWeigher.java

示例3: testKeysRemovedWhenIdentityStrategyIsUsed

public void testKeysRemovedWhenIdentityStrategyIsUsed() {
  ConcurrentWeakHashMap<Object, Object> map = new ConcurrentWeakHashMap<Object, Object>(TObjectHashingStrategy.IDENTITY);
  map.put(new Object(), new Object());

  do {
    System.gc();
  }
  while (!map.processQueue());
  map.put(this, this);
  assertEquals(1, map.underlyingMapSize());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:ConcurrentWeakHashMapTest.java

示例4: classify

@Override
public Iterable<LookupElement> classify(Iterable<LookupElement> source, final ProcessingContext context) {
  checkPrefixChanged(context);

  final Collection<List<LookupElement>> byWeight = buildMapByWeight(source).descendingMap().values();

  List<LookupElement> initialList = getInitialNoStatElements(source, context);

  //noinspection unchecked
  final THashSet<LookupElement> initialSet = new THashSet<LookupElement>(initialList, TObjectHashingStrategy.IDENTITY);
  final Condition<LookupElement> notInInitialList = new Condition<LookupElement>() {
    @Override
    public boolean value(LookupElement element) {
      return !initialSet.contains(element);
    }
  };

  return ContainerUtil.concat(initialList, new Iterable<LookupElement>() {
    @Override
    public Iterator<LookupElement> iterator() {
      return new FlatteningIterator<List<LookupElement>, LookupElement>(byWeight.iterator()) {
        @Override
        protected Iterator<LookupElement> createValueIterator(List<LookupElement> group) {
          return myNext.classify(ContainerUtil.findAll(group, notInInitialList), context).iterator();
        }
      };
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:StatisticsWeigher.java

示例5: identityStrategy

@SuppressWarnings("unchecked")
@NotNull
@Contract(pure=true)
public static <T> TObjectHashingStrategy<T> identityStrategy() {
  return TObjectHashingStrategy.IDENTITY;
}
 
开发者ID:JetBrains,项目名称:jediterm,代码行数:6,代码来源:ContainerUtil.java


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