本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例7: reserveName
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public void reserveName(DexString name) {
if (reservedNames == null) {
reservedNames = Sets.newIdentityHashSet();
}
reservedNames.add(name);
}
示例8: ensureDirectSubTypeSet
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private void ensureDirectSubTypeSet() {
if (directSubtypes == NO_DIRECT_SUBTYPE) {
directSubtypes = Sets.newIdentityHashSet();
}
}
示例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);
}