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


Java Sets.newIdentityHashSet方法代码示例

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


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

示例1: processMethod

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private Set<DexField> processMethod(DexEncodedMethod method, UseRegistry registry,
    Set<DexField> state) {
  if (state == null) {
    state = Sets.newIdentityHashSet();
  }
  if (isSetterThatNeedsProcessing(method)) {
    // If a field is accessed by a live setter, the field is live as it has to be written to the
    // serialized stream for this proto. As we mask all reads in the writing code and normally
    // remove fields that are only written but never read, we have to mark fields used in setters
    // as read and written.
    method.registerReachableDefinitions(
        new FieldWriteImpliesReadUseRegistry(registry, method.method.holder));
  } else {
    // Filter all getters and field accesses in these methods. We do not want fields to become
    // live just due to being referenced in a special method. The pruning phase will remove
    // all references to dead fields in the code later.
    method.registerReachableDefinitions(new FilteringUseRegistry(registry, method.method.holder,
        state));
  }
  return state;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:22,代码来源:ProtoLiteExtension.java

示例2: resolveDependencies

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Set<AndroidDependency> resolveDependencies(
        @NonNull VariantDependencies variantDeps,
        @Nullable String testedProjectPath) {
    // set of Android Libraries to explode. This only concerns remote libraries, as modules
    // are now used through their staging folders rather than their bundled AARs.
    // Therefore there is no dependency on these exploded tasks since remote AARs are
    // downloaded during the dependency resolution process.
    // because they are not immutable (them or the children could be skipped()), we use
    // an identity set.
    Set<AndroidDependency> libsToExplode = Sets.newIdentityHashSet();

    resolveDependencies(
            variantDeps,
            testedProjectPath,
            libsToExplode);
    return libsToExplode;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:18,代码来源:DependencyManager.java

示例3: main

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static void main(String[] args) {
    Set<Integer> identitySet = Sets.newIdentityHashSet();
    Set<Integer> hashSet = Sets.newHashSet();

    Integer value1 = new Integer(12357);
    Integer value2 = new Integer(12357);

    // identitySet 操作
    System.out.println(identitySet.add(value1));
    System.out.println(identitySet.contains(value2));
    System.out.println(identitySet.contains(value1));
    System.out.println(identitySet.add(value2));
    System.out.println(identitySet.size());

    System.out.println("=====================================");

    // hashSet 操作
    System.out.println(hashSet.add(value1));
    System.out.println(hashSet.contains(value2));
    System.out.println(hashSet.contains(value1));
    System.out.println(hashSet.add(value2));
    System.out.println(hashSet.size());
}
 
开发者ID:cbooy,项目名称:cakes,代码行数:24,代码来源:TestIdentifySet.java

示例4: collectTypes

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Collection<DexType> collectTypes() {
  Set<DexType> types = Sets.newIdentityHashSet();
  for (ClassProvider<T> provider : providers) {
    types.addAll(provider.collectTypes());
  }
  return types;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:9,代码来源:ClassProvider.java

示例5: parse

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static Set<DexType> parse(InputStream input, DexItemFactory itemFactory) {
  Set<DexType> result = Sets.newIdentityHashSet();
  try {
    BufferedReader file =
        new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
    String line;
    while ((line = file.readLine()) != null) {
      result.add(parse(line, itemFactory));
    }
  } catch (IOException e) {
    throw new CompilationError("Cannot load main-dex-list.");
  }
  return result;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:15,代码来源:MainDexList.java

示例6: breakCycles

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private int breakCycles() {
  // Break cycles in this call graph by removing edges causing cycles.
  // The remove edges are stored in @breakers.
  int numberOfCycles = 0;
  Set<Node> stack = Sets.newIdentityHashSet();
  Set<Node> marked = Sets.newIdentityHashSet();
  for (Node node : nodes.values()) {
    numberOfCycles += traverse(node, stack, marked);
  }
  return numberOfCycles;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:12,代码来源:CallGraph.java

示例7: reserveName

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public void reserveName(DexString name) {
  if (reservedNames == null) {
    reservedNames = Sets.newIdentityHashSet();
  }
  reservedNames.add(name);
}
 
开发者ID:inferjay,项目名称:r8,代码行数:7,代码来源:NamingState.java

示例8: ensureDirectSubTypeSet

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void ensureDirectSubTypeSet() {
  if (directSubtypes == NO_DIRECT_SUBTYPE) {
    directSubtypes = Sets.newIdentityHashSet();
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:6,代码来源:DexType.java

示例9: uniqifyGraph

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public static Prel uniqifyGraph(Prel p) {
  Set<Prel> data = Sets.newIdentityHashSet();
  return p.accept(INSTANCE, data);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:RelUniqifier.java


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