本文整理汇总了Java中com.google.common.collect.Sets.newLinkedHashSetWithExpectedSize方法的典型用法代码示例。如果您正苦于以下问题:Java Sets.newLinkedHashSetWithExpectedSize方法的具体用法?Java Sets.newLinkedHashSetWithExpectedSize怎么用?Java Sets.newLinkedHashSetWithExpectedSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Sets
的用法示例。
在下文中一共展示了Sets.newLinkedHashSetWithExpectedSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerDescription
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void registerDescription(final IResourceDescription description,
final Map<QualifiedName, Object> target) {
for (final IEObjectDescription object : description.getExportedObjects()) {
final QualifiedName lowerCase = object.getName().toLowerCase();
final Object existing = target.put(lowerCase, description);
if (existing != null && existing != description) {
Set<IResourceDescription> set = null;
if (existing instanceof IResourceDescription) {
// The linked hash set is the difference comparing to the super class.
set = Sets.newLinkedHashSetWithExpectedSize(2);
set.add((IResourceDescription) existing);
} else {
set = (Set<IResourceDescription>) existing;
}
set.add(description);
target.put(lowerCase, set);
}
}
}
示例2: map
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private static Set<IvyArtifactName> map(List<Artifact> dependencyArtifacts) {
if (dependencyArtifacts.isEmpty()) {
return ImmutableSet.of();
}
Set<IvyArtifactName> result = Sets.newLinkedHashSetWithExpectedSize(dependencyArtifacts.size());
for (Artifact artifact : dependencyArtifacts) {
result.add(artifact.getArtifactName());
}
return result;
}
示例3: allAnnotatedElements
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private Set<Element> allAnnotatedElements() {
Set<Element> elements = Sets.newLinkedHashSetWithExpectedSize(100);
for (TypeElement annotation : annotations()) {
Set<? extends Element> annotatedElements = round().getElementsAnnotatedWith(annotation);
checkAnnotation(annotation, annotatedElements);
elements.addAll(annotatedElements);
}
return elements;
}