本文整理匯總了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);
}
示例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 */);
}
示例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);
}
示例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));
}
}
示例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);
}
示例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(); }
});
}
示例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);
}
示例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++);
}
}
示例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());
}
示例10: getAnnotations
import com.google.common.collect.ImmutableSortedSet; //導入方法依賴的package包/類
public SortedSet<AnnotationMember> getAnnotations() {
return ImmutableSortedSet.copyOf(annotations);
}
示例11: getParameterAnnotations
import com.google.common.collect.ImmutableSortedSet; //導入方法依賴的package包/類
public SortedSet<AnnotationMember> getParameterAnnotations() {
return ImmutableSortedSet.copyOf(parameterAnnotations);
}
示例12: create
import com.google.common.collect.ImmutableSortedSet; //導入方法依賴的package包/類
@Override
public Set<UnhashableObject> create(UnhashableObject[] elements) {
return ImmutableSortedSet.copyOf(elements);
}
示例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)));
}
示例14: create
import com.google.common.collect.ImmutableSortedSet; //導入方法依賴的package包/類
@Override
protected SortedSet<String> create(String[] elements) {
return ImmutableSortedSet.copyOf(elements);
}
示例15: getReferenceCounts
import com.google.common.collect.ImmutableSortedSet; //導入方法依賴的package包/類
@Override
ImmutableSortedSet<Integer> getReferenceCounts() {
return ImmutableSortedSet.copyOf(logFileIDReferenceCounts.keySet());
}