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


Java Sets.newTreeSet方法代码示例

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


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

示例1: list

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public synchronized NavigableSet<NamespaceDescriptor> list() throws IOException {
  NavigableSet<NamespaceDescriptor> ret =
      Sets.newTreeSet(NamespaceDescriptor.NAMESPACE_DESCRIPTOR_COMPARATOR);
  ResultScanner scanner = getNamespaceTable().getScanner(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES);
  try {
    for(Result r : scanner) {
      byte[] val = CellUtil.cloneValue(r.getColumnLatestCell(
        HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
        HTableDescriptor.NAMESPACE_COL_DESC_BYTES));
      ret.add(ProtobufUtil.toNamespaceDescriptor(
          HBaseProtos.NamespaceDescriptor.parseFrom(val)));
    }
  } finally {
    scanner.close();
  }
  return ret;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TableNamespaceManager.java

示例2: formatConfiguration

import com.google.common.collect.Sets; //导入方法依赖的package包/类
static void formatConfiguration(StringBuilder sb, AttributeContainer fromConfigurationAttributes, AttributesSchema consumerSchema, List<ConfigurationMetadata> matches, Set<String> requestedAttributes, int maxConfLength, final String conf) {
    Optional<ConfigurationMetadata> match = Iterables.tryFind(matches, new Predicate<ConfigurationMetadata>() {
        @Override
        public boolean apply(ConfigurationMetadata input) {
            return conf.equals(input.getName());
        }
    });
    if (match.isPresent()) {
        AttributeContainer producerAttributes = match.get().getAttributes();
        Set<Attribute<?>> targetAttributes = producerAttributes.keySet();
        Set<String> targetAttributeNames = Sets.newTreeSet(Iterables.transform(targetAttributes, ATTRIBUTE_NAME));
        Set<Attribute<?>> allAttributes = Sets.union(fromConfigurationAttributes.keySet(), producerAttributes.keySet());
        Set<String> commonAttributes = Sets.intersection(requestedAttributes, targetAttributeNames);
        Set<String> consumerOnlyAttributes = Sets.difference(requestedAttributes, targetAttributeNames);
        sb.append("   ").append("- Configuration '").append(StringUtils.rightPad(conf + "'", maxConfLength + 1)).append(" :");
        List<Attribute<?>> sortedAttributes = Ordering.usingToString().sortedCopy(allAttributes);
        List<String> values = new ArrayList<String>(sortedAttributes.size());
        formatAttributes(sb, fromConfigurationAttributes, consumerSchema, producerAttributes, commonAttributes, consumerOnlyAttributes, sortedAttributes, values);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:AmbiguousConfigurationSelectionException.java

示例3: generateMessage

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private static String generateMessage(AttributeContainer fromConfigurationAttributes, AttributesSchema consumerSchema, ComponentResolveMetadata targetComponent, List<String> configurationNames) {
    List<ConfigurationMetadata> configurations = new ArrayList<ConfigurationMetadata>(configurationNames.size());
    for (String name : configurationNames) {
        ConfigurationMetadata targetComponentConfiguration = targetComponent.getConfiguration(name);
        if (targetComponentConfiguration.isCanBeConsumed() && !targetComponentConfiguration.getAttributes().isEmpty()) {
            configurations.add(targetComponentConfiguration);
        }
    }
    Set<String> requestedAttributes = Sets.newTreeSet(Iterables.transform(fromConfigurationAttributes.keySet(), ATTRIBUTE_NAME));
    StringBuilder sb = new StringBuilder("Unable to find a matching configuration in '" + targetComponent +"' :");
    if (configurations.isEmpty()) {
        sb.append(" None of the consumable configurations have attributes.");
    } else {
        sb.append("\n");
        int maxConfLength = maxLength(configurationNames);
        // We're sorting the names of the configurations and later attributes
        // to make sure the output is consistently the same between invocations
        for (final String config : configurationNames) {
            formatConfiguration(sb, fromConfigurationAttributes, consumerSchema, configurations, requestedAttributes, maxConfLength, config);
        }
    }
    return sb.toString();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:NoMatchingConfigurationSelectionException.java

示例4: buildRecursively

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private List<ConsumerProvidedTaskSelector> buildRecursively(GradleProject project) {
    Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();

    collectTasks(project, aggregatedTasks);

    List<ConsumerProvidedTaskSelector> selectors = Lists.newArrayList();
    for (String selectorName : aggregatedTasks.keySet()) {
        SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
        selectorTasks.addAll(aggregatedTasks.get(selectorName));
        selectors.add(new ConsumerProvidedTaskSelector().
                setName(selectorName).
                setTaskNames(selectorTasks).
                setDescription(project.getParent() != null
                        ? String.format("%s:%s task selector", project.getPath(), selectorName)
                        : String.format("%s task selector", selectorName)).
                setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
    }
    return selectors;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:BuildInvocationsConverter.java

示例5: assertGlobEquals

import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
 * List all of the files in 'dir' that match the regex 'pattern'.
 * Then check that this list is identical to 'expectedMatches'.
 * @throws IOException if the dir is inaccessible
 */
public static void assertGlobEquals(File dir, String pattern,
    String ... expectedMatches) throws IOException {
  
  Set<String> found = Sets.newTreeSet();
  for (File f : FileUtil.listFiles(dir)) {
    if (f.getName().matches(pattern)) {
      found.add(f.getName());
    }
  }
  Set<String> expectedSet = Sets.newTreeSet(
      Arrays.asList(expectedMatches));
  Assert.assertEquals("Bad files matching " + pattern + " in " + dir,
      Joiner.on(",").join(expectedSet),
      Joiner.on(",").join(found));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:GenericTestUtils.java

示例6: FSWALEntry

import com.google.common.collect.Sets; //导入方法依赖的package包/类
FSWALEntry(final long sequence, final WALKey key, final WALEdit edit,
    final HTableDescriptor htd, final HRegionInfo hri, final boolean inMemstore) {
  super(key, edit);
  this.inMemstore = inMemstore;
  this.htd = htd;
  this.hri = hri;
  this.sequence = sequence;
  if (inMemstore) {
    // construct familyNames here to reduce the work of log sinker.
    ArrayList<Cell> cells = this.getEdit().getCells();
    if (CollectionUtils.isEmpty(cells)) {
      this.familyNames = Collections.<byte[]> emptySet();
    } else {
      Set<byte[]> familySet = Sets.newTreeSet(Bytes.BYTES_COMPARATOR);
      for (Cell cell : cells) {
        if (!CellUtil.matchingFamily(cell, WALEdit.METAFAMILY)) {
          familySet.add(CellUtil.cloneFamily(cell));
        }
      }
      this.familyNames = Collections.unmodifiableSet(familySet);
    }
  } else {
    this.familyNames = Collections.<byte[]> emptySet();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:FSWALEntry.java

示例7: generateMessage

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private static String generateMessage(AttributeContainer fromConfigurationAttributes, AttributesSchema consumerSchema, List<ConfigurationMetadata> matches, ComponentResolveMetadata targetComponent) {
    Set<String> ambiguousConfigurations = Sets.newTreeSet(Lists.transform(matches, CONFIG_NAME));
    Set<String> requestedAttributes = Sets.newTreeSet(Iterables.transform(fromConfigurationAttributes.keySet(), ATTRIBUTE_NAME));
    StringBuilder sb = new StringBuilder("Cannot choose between the following configurations on '" + targetComponent + "' : ");
    JOINER.appendTo(sb, ambiguousConfigurations);
    sb.append(". All of them match the consumer attributes:");
    sb.append("\n");
    int maxConfLength = maxLength(ambiguousConfigurations);
    // We're sorting the names of the configurations and later attributes
    // to make sure the output is consistently the same between invocations
    for (final String ambiguousConf : ambiguousConfigurations) {
        formatConfiguration(sb, fromConfigurationAttributes, consumerSchema, matches, requestedAttributes, maxConfLength, ambiguousConf);
    }
    return sb.toString();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:AmbiguousConfigurationSelectionException.java

示例8: buildDoubleGlobalDictionary

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private static VectorContainer buildDoubleGlobalDictionary(List<Dictionary> dictionaries, VectorContainer existingDict, ColumnDescriptor columnDescriptor, BufferAllocator bufferAllocator) {
  final Field field = new Field(SchemaPath.getCompoundPath(columnDescriptor.getPath()).getAsUnescapedPath(), true, new ArrowType.FloatingPoint(FloatingPointPrecision.DOUBLE), null);
  final VectorContainer input = new VectorContainer(bufferAllocator);
  final NullableFloat8Vector doubleVector = input.addOrGet(field);
  doubleVector.allocateNew();
  SortedSet<Double> values = Sets.newTreeSet();
  for (Dictionary dictionary : dictionaries) {
    for (int i = 0; i <= dictionary.getMaxId(); ++i) {
      values.add(dictionary.decodeToDouble(i));
    }
  }
  if (existingDict != null) {
    final NullableFloat8Vector existingDictValues = existingDict.getValueAccessorById(NullableFloat8Vector.class, 0).getValueVector();
    for (int i = 0; i < existingDict.getRecordCount(); ++i) {
      values.add(existingDictValues.getAccessor().get(i));
    }
  }
  final Iterator<Double> iter = values.iterator();
  int recordCount = 0;
  while (iter.hasNext()) {
    doubleVector.getMutator().setSafe(recordCount++, iter.next());
  }
  doubleVector.getMutator().setValueCount(recordCount);
  input.setRecordCount(recordCount);
  input.buildSchema(BatchSchema.SelectionVectorMode.NONE);
  return input;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:GlobalDictionaryBuilder.java

示例9: buildFloatGlobalDictionary

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private static VectorContainer buildFloatGlobalDictionary(List<Dictionary> dictionaries, VectorContainer existingDict, ColumnDescriptor columnDescriptor, BufferAllocator bufferAllocator) {
  final Field field = new Field(SchemaPath.getCompoundPath(columnDescriptor.getPath()).getAsUnescapedPath(), true, new ArrowType.FloatingPoint(FloatingPointPrecision.SINGLE), null);
  final VectorContainer input = new VectorContainer(bufferAllocator);
  final NullableFloat4Vector floatVector = input.addOrGet(field);
  floatVector.allocateNew();
  SortedSet<Float> values = Sets.newTreeSet();
  for (Dictionary dictionary : dictionaries) {
    for (int i = 0; i <= dictionary.getMaxId(); ++i) {
      values.add(dictionary.decodeToFloat(i));
    }
  }
  if (existingDict != null) {
    final NullableFloat4Vector existingDictValues = existingDict.getValueAccessorById(NullableFloat4Vector.class, 0).getValueVector();
    for (int i = 0; i < existingDict.getRecordCount(); ++i) {
      values.add(existingDictValues.getAccessor().get(i));
    }
  }
  final Iterator<Float> iter = values.iterator();
  int recordCount = 0;
  while (iter.hasNext()) {
    floatVector.getMutator().setSafe(recordCount++, iter.next());
  }
  floatVector.getMutator().setValueCount(recordCount);
  input.setRecordCount(recordCount);
  input.buildSchema(BatchSchema.SelectionVectorMode.NONE);
  return input;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:28,代码来源:GlobalDictionaryBuilder.java

示例10: Rule

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public Rule(Artifact artifact, String alias) {
  this.artifact = artifact;
  this.version = artifact.getVersion();
  this.parents = Sets.newHashSet();
  this.dependencies = Sets.newTreeSet();
  this.exclusions = Sets.newHashSet();
  this.repository = MAVEN_CENTRAL_URL;
  this.alias = alias;
}
 
开发者ID:bazelbuild,项目名称:migration-tooling,代码行数:10,代码来源:Rule.java

示例11: getTaskNames

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public SortedSet<String> getTaskNames() {
    // TODO use comparator
    SortedSet<String> result = Sets.newTreeSet(new TaskNameComparator());
    result.add(getPath());
    return result;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:7,代码来源:ConsumerProvidedTask.java

示例12: collectAdditionalSourceSets

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private Set<LanguageSourceSet> collectAdditionalSourceSets(Collection<LanguageSourceSet> sourceSets) {
    Set<LanguageSourceSet> result = Sets.newTreeSet(SourceSetRenderer.SORT_ORDER);
    result.addAll(sourceSets);
    result.removeAll(sourceSetRenderer.getItems());
    return result;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:7,代码来源:ComponentReportRenderer.java

示例13: getLanguages

import com.google.common.collect.Sets; //导入方法依赖的package包/类
public SortedSet<Language> getLanguages()
{
    return Sets.newTreeSet(this.languageMap.values());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:LanguageManager.java

示例14: sortedToStringsFrom

import com.google.common.collect.Sets; //导入方法依赖的package包/类
private TreeSet<String> sortedToStringsFrom(Iterable<?> iterable) {
  return Sets.newTreeSet(FluentIterable.from(iterable).transform(Functions.toStringFunction()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ServiceTest.java

示例15: getImportedNames

import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Iterable<QualifiedName> getImportedNames() {
	if (null == lazyImportedNames) {
		synchronized (this) {
			if (null == lazyImportedNames) {
				// get imported names collected during global scoping
				// the scope provider registers every request in scoping so that by this
				// also all names are collected that cannot be resolved
				Iterable<QualifiedName> superImportedNames = super.getImportedNames();
				// use sorted set to ensure order of items
				final SortedSet<QualifiedName> importedNames;
				if (superImportedNames != null) {
					importedNames = Sets.newTreeSet(superImportedNames);
				} else {
					importedNames = Sets.<QualifiedName> newTreeSet();
				}
				// import our own module name to get a proper change notification
				Resource resource = getResource();
				List<EObject> contents = resource.getContents();
				if (contents.size() > 1) {
					TModule module = (TModule) contents.get(1);
					importedNames.add(qualifiedNameProvider.getFullyQualifiedName(module));
				}
				final Set<EObject> crossRefTypes = Sets.newHashSet();
				IAcceptor<EObject> acceptor = getCrossRefTypeAcceptor(crossRefTypes);
				crossReferenceComputer.computeCrossRefs(resource, acceptor);
				for (EObject type : crossRefTypes) {
					if (type instanceof Type) {
						handleType(importedNames, type);
					} else if (type instanceof TVariable) {
						handleTVariable(importedNames, (TVariable) type);
					} else if (type instanceof TEnumLiteral) {
						handleTEnumLiteral(importedNames, (TEnumLiteral) type);
					}
				}
				this.lazyImportedNames = importedNames;
			}
		}
	}

	return lazyImportedNames;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:43,代码来源:N4JSResourceDescription.java


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