Java Code Examples for com.google.common.collect.ImmutableSortedMap#copyOfSorted()
The following examples show how to use
com.google.common.collect.ImmutableSortedMap#copyOfSorted() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleMetaCache.java From LuckPerms with MIT License | 5 votes |
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(); }
Example 2
Source File: CollectionUtils.java From nomulus with Apache License 2.0 | 4 votes |
/** 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); }
Example 3
Source File: TimedTransitionProperty.java From nomulus with Apache License 2.0 | 4 votes |
/** 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)); }
Example 4
Source File: AnnotatedInterval.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** 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); }
Example 5
Source File: TenorRawOptionData.java From Strata with Apache License 2.0 | 4 votes |
private TenorRawOptionData( SortedMap<Tenor, RawOptionData> data) { JodaBeanUtils.notNull(data, "data"); this.data = ImmutableSortedMap.copyOfSorted(data); }
Example 6
Source File: CollectionExtensions.java From xtext-lib with Eclipse Public License 2.0 | 2 votes |
/** * 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); }