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


Java ImmutableSortedSet.copyOf方法代码示例

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


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

示例1: initializePropertySources

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
protected void initializePropertySources() {
  if (environment.getPropertySources().contains(APOLLO_PROPERTY_SOURCE_NAME)) {
    //already initialized
    return;
  }
  CompositePropertySource composite = new CompositePropertySource(APOLLO_PROPERTY_SOURCE_NAME);

  //sort by order asc
  ImmutableSortedSet<Integer> orders = ImmutableSortedSet.copyOf(NAMESPACE_NAMES.keySet());
  Iterator<Integer> iterator = orders.iterator();

  while (iterator.hasNext()) {
    int order = iterator.next();
    for (String namespace : NAMESPACE_NAMES.get(order)) {
      Config config = ConfigService.getConfig(namespace);

      composite.addPropertySource(new ConfigPropertySource(namespace, config));
    }
  }
  environment.getPropertySources().addFirst(composite);
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:22,代码来源:PropertySourcesProcessor.java

示例2: maplist

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Command(
    aliases = {"maplist", "maps", "ml"},
    desc = "Shows the maps that are currently loaded",
    usage = "[page]",
    min = 0,
    max = 1,
    help = "Shows all the maps that are currently loaded including ones that are not in the rotation."
)
@CommandPermissions("pgm.maplist")
public static void maplist(CommandContext args, final CommandSender sender) throws CommandException {
    final Set<PGMMap> maps = ImmutableSortedSet.copyOf(new PGMMap.DisplayOrder(), PGM.getMatchManager().getMaps());

    new PrettyPaginatedResult<PGMMap>(PGMTranslations.get().t("command.map.mapList.title", sender)) {
        @Override public String format(PGMMap map, int index) {
            return (index + 1) + ". " + map.getInfo().getShortDescription(sender);
        }
    }.display(new BukkitWrappedCommandSender(sender), maps, args.getInteger(0, 1) /* page */);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:19,代码来源:MapCommands.java

示例3: toSortedSet

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Nonnull
private static <T> SortedSet<? extends T> toSortedSet(@Nonnull Comparator<? super T> elementComparator,
                                                      @Nonnull Collection<? extends T> collection) {
    if (collection instanceof SortedSet) {
        SortedSet<? extends T> sortedSet = (SortedSet<? extends T>)collection;
        Comparator<?> comparator = sortedSet.comparator();
        if (comparator != null && comparator.equals(elementComparator)) {
            return sortedSet;
        }
    }
    return ImmutableSortedSet.copyOf(elementComparator, collection);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:13,代码来源:CollectionUtils.java

示例4: propertyDescription

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
private static String propertyDescription(ModelSchemaExtractionContext<?> parentContext, ModelProperty<?> property) {
    if (property.getDeclaredBy().size() == 1 && property.getDeclaredBy().contains(parentContext.getType())) {
        return String.format("property '%s'", property.getName());
    } else {
        ImmutableSortedSet<String> declaredBy = ImmutableSortedSet.copyOf(Iterables.transform(property.getDeclaredBy(), Functions.toStringFunction()));
        return String.format("property '%s' declared by %s", property.getName(), Joiner.on(", ").join(declaredBy));
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:StructSchemaExtractionStrategySupport.java

示例5: toNaturalSortedSet

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Nonnull
private static <T> SortedSet<? extends T> toNaturalSortedSet(@Nonnull Collection<? extends T> collection) {
    if (isNaturalSortedSet(collection)) {
        return (SortedSet<? extends T>)collection;
    }
    return ImmutableSortedSet.copyOf(collection);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:8,代码来源:CollectionUtils.java

示例6: toSortedSet

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Nonnull
public ImmutableSortedSet<ImmutableItem> toSortedSet(@Nonnull Comparator<? super ImmutableItem> comparator,
                                                     @Nullable final Iterable<? extends Item> iterable) {
    if (iterable == null) {
        return ImmutableSortedSet.of();
    }

    boolean needsCopy = false;
    if (iterable instanceof ImmutableSortedSet &&
            ((ImmutableSortedSet)iterable).comparator().equals(comparator)) {
        for (Item element: iterable) {
            if (!isImmutable(element)) {
                needsCopy = true;
                break;
            }
        }
    } else {
        needsCopy = true;
    }

    if (!needsCopy) {
        return (ImmutableSortedSet<ImmutableItem>)iterable;
    }

    final Iterator<? extends Item> iter = iterable.iterator();


    return ImmutableSortedSet.copyOf(comparator, new Iterator<ImmutableItem>() {
        @Override public boolean hasNext() { return iter.hasNext(); }
        @Override public ImmutableItem next() { return makeImmutable(iter.next()); }
        @Override public void remove() { iter.remove(); }
    });
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:34,代码来源:ImmutableConverter.java

示例7: ShortestPathTable

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * The shortest path table will be computed upon construction.
 * 
 * @param ontology
 */
public ShortestPathTable(Ontology<?, ?> ontology) {
  termIdCount = ontology.getNonObsoleteTermIds().size();
  distances = new int[termIdCount * termIdCount];
  termIdToIdx = new HashMap<>(termIdCount);

  int i = 0;
  for (TermId termId : ImmutableSortedSet.copyOf(ontology.getNonObsoleteTermIds())) {
    termIdToIdx.put(termId, i++);
  }

  precomputeDistances(ontology);
}
 
开发者ID:johntiger1,项目名称:boqa,代码行数:20,代码来源:ShortestPathTable.java

示例8: PrecomputedScores

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
PrecomputedScores(Collection<TermId> termIds) {
  termIdCount = termIds.size();
  data = new float[termIdCount * termIdCount];
  termIdToIdx = new HashMap<>(termIdCount);

  int i = 0;
  for (TermId termId : ImmutableSortedSet.copyOf(termIds)) {
    termIdToIdx.put(termId, i++);
  }
}
 
开发者ID:johntiger1,项目名称:boqa,代码行数:11,代码来源:PrecomputingPairwiseResnikSimilarity.java

示例9: test

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Test
public void test() {
  Set<TermId> inputIds = Sets.newHashSet(id1);
  Set<TermId> outputIds =
      ImmutableSortedSet.copyOf(TermIds.augmentWithAncestors(ontology, inputIds, true));
  assertEquals(
      "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000002], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000003], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]]",
      outputIds.toString());
}
 
开发者ID:Phenomics,项目名称:ontolib,代码行数:10,代码来源:TermIdsTest.java

示例10: getAnnotations

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
public SortedSet<AnnotationMember> getAnnotations() {
    return ImmutableSortedSet.copyOf(annotations);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:AnnotatableMember.java

示例11: getParameterAnnotations

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
public SortedSet<AnnotationMember> getParameterAnnotations() {
    return ImmutableSortedSet.copyOf(parameterAnnotations);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:MethodMember.java

示例12: create

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Override
public Set<UnhashableObject> create(UnhashableObject[] elements) {
  return ImmutableSortedSet.copyOf(elements);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:5,代码来源:SetGenerators.java

示例13: collectFieldsWritten

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
SortedSet<DexField> collectFieldsWritten() {
  return ImmutableSortedSet.copyOf(PresortedComparable::slowCompareTo,
      Sets.union(collectReachedFields(instanceFieldsWritten, this::tryLookupInstanceField),
      collectReachedFields(staticFieldsWritten, this::tryLookupStaticField)));
}
 
开发者ID:inferjay,项目名称:r8,代码行数:6,代码来源:Enqueuer.java

示例14: create

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Override
protected SortedSet<String> create(String[] elements) {
  return ImmutableSortedSet.copyOf(elements);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:5,代码来源:SetGenerators.java

示例15: getReferenceCounts

import com.google.common.collect.ImmutableSortedSet; //导入方法依赖的package包/类
@Override
ImmutableSortedSet<Integer> getReferenceCounts() {
  return ImmutableSortedSet.copyOf(logFileIDReferenceCounts.keySet());
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:5,代码来源:EventQueueBackingStoreFile.java


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