com.google.common.collect.ImmutableSortedMap#copyOfSorted ( )源码实例Demo

下面列出了com.google.common.collect.ImmutableSortedMap#copyOfSorted ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LuckPerms   文件: SimpleMetaCache.java
public void loadMeta(MetaAccumulator meta) {
    this.meta = Multimaps.asMap(ImmutableListMultimap.copyOf(meta.getMeta()));

    MetaValueSelector metaValueSelector = this.queryOptions.option(MetaValueSelector.KEY)
            .orElseGet(() -> this.plugin.getConfiguration().get(ConfigKeys.META_VALUE_SELECTOR));

    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    for (Map.Entry<String, List<String>> e : this.meta.entrySet()) {
        if (e.getValue().isEmpty()) {
            continue;
        }

        String selected = metaValueSelector.selectValue(e.getKey(), e.getValue());
        if (selected == null) {
            throw new NullPointerException(metaValueSelector + " returned null");
        }

        builder.put(e.getKey(), selected);
    }
    this.flattenedMeta = builder.build();

    this.prefixes = ImmutableSortedMap.copyOfSorted(meta.getPrefixes());
    this.suffixes = ImmutableSortedMap.copyOfSorted(meta.getSuffixes());
    this.weight = meta.getWeight();
    this.primaryGroup = meta.getPrimaryGroup();
    this.prefixDefinition = meta.getPrefixDefinition();
    this.suffixDefinition = meta.getSuffixDefinition();
    this.prefix = meta.getPrefix();
    this.suffix = meta.getSuffix();
}
 
源代码2 项目: nomulus   文件: CollectionUtils.java
/** Defensive copy helper for {@link SortedMap}. */
public static <K, V> ImmutableSortedMap<K, V> nullToEmptyImmutableCopy(SortedMap<K, V> data) {
  return data == null ? ImmutableSortedMap.of() : ImmutableSortedMap.copyOfSorted(data);
}
 
源代码3 项目: nomulus   文件: TimedTransitionProperty.java
/** Returns the map of DateTime to value that is the "natural" representation of this property. */
public ImmutableSortedMap<DateTime, V> toValueMap() {
  return ImmutableSortedMap.copyOfSorted(Maps.transformValues(backingMap, T::getValue));
}
 
源代码4 项目: gatk   文件: AnnotatedInterval.java
/** Returns a copy of the annotations as a map.
 * Dev note: this does not create a copy, unless necessary.  See {@link ImmutableSortedMap#copyOfSorted(SortedMap)}*/
public ImmutableSortedMap<String, String> getAnnotations() {
    return ImmutableSortedMap.copyOfSorted(this.annotations);
}
 
源代码5 项目: Strata   文件: TenorRawOptionData.java
private TenorRawOptionData(
    SortedMap<Tenor, RawOptionData> data) {
  JodaBeanUtils.notNull(data, "data");
  this.data = ImmutableSortedMap.copyOfSorted(data);
}
 
源代码6 项目: xtext-lib   文件: CollectionExtensions.java
/**
 * Returns an immutable copy of the specified sorted {@code map}.
 * 
 * @param map
 *            the sorted map for which an immutable copy should be created. May not be <code>null</code>.
 * @return an immutable copy of the specified sorted map.
 */
@Inline(value="$2.$3copyOfSorted($1)", imported=ImmutableSortedMap.class)
public static <K, V> SortedMap<K, V> immutableCopy(SortedMap<K, ? extends V> map) {
	return ImmutableSortedMap.copyOfSorted(map);
}