input -> checkNotNull(keyFunction.apply(input)), input -> valuesFunction.apply(input).peek(Preconditions::checkNotNull), MultimapBuilder.linkedHashKeys().linkedHashSetValues()::<K, V>build), ImmutableSetMultimap::copyOf);
input -> checkNotNull(keyFunction.apply(input)), input -> valuesFunction.apply(input).peek(Preconditions::checkNotNull), MultimapBuilder.linkedHashKeys().linkedHashSetValues()::<K, V>build), ImmutableSetMultimap::copyOf);
@GwtIncompatible // serialization public void testSerialization() throws Exception { for (MultimapBuilderWithKeys<?> builderWithKeys : ImmutableList.of( MultimapBuilder.hashKeys(), MultimapBuilder.linkedHashKeys(), MultimapBuilder.treeKeys(), MultimapBuilder.enumKeys(RoundingMode.class))) { for (MultimapBuilder<?, ?> builder : ImmutableList.of( builderWithKeys.arrayListValues(), builderWithKeys.linkedListValues(), builderWithKeys.hashSetValues(), builderWithKeys.linkedHashSetValues(), builderWithKeys.treeSetValues(), builderWithKeys.enumSetValues(RoundingMode.class))) { /* * Temporarily inlining SerializableTester here for obscure internal reasons. */ reserializeAndAssert(builder.build()); } } }
SetMultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); subCartesian = SetMultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); splitKeyToSmallCartesian.put(subCartesianMap, subCartesian);
keyToInValues = SetMultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); flatMaps = new LinkedHashSet<>();
@GwtIncompatible // serialization public void testSerialization() throws Exception { for (MultimapBuilderWithKeys<?> builderWithKeys : ImmutableList.of( MultimapBuilder.hashKeys(), MultimapBuilder.linkedHashKeys(), MultimapBuilder.treeKeys(), MultimapBuilder.enumKeys(RoundingMode.class))) { for (MultimapBuilder<?, ?> builder : ImmutableList.of( builderWithKeys.arrayListValues(), builderWithKeys.linkedListValues(), builderWithKeys.hashSetValues(), builderWithKeys.linkedHashSetValues(), builderWithKeys.treeSetValues(), builderWithKeys.enumSetValues(RoundingMode.class))) { /* * Temporarily inlining SerializableTester here for obscure internal reasons. */ reserializeAndAssert(builder.build()); } } }
/** * Returns a newly-created immutable set multimap. */ @Override public ImmutableSetMultimap<K, V> build() { if (keyComparator != null) { Multimap<K, V> sortedCopy = MultimapBuilder.linkedHashKeys().linkedHashSetValues().<K, V> build(); List<Map.Entry<K, Collection<V>>> entries = Ordering.from(keyComparator) .<K> onKeys() .immutableSortedCopy(builderMultimap.asMap().entrySet()); for (Map.Entry<K, Collection<V>> entry : entries) { sortedCopy.putAll(entry.getKey(), entry.getValue()); } builderMultimap = sortedCopy; } return copyOf(builderMultimap, valueComparator); } }
/** Uses an insertion-ordered hash-based {@code Set} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
/** Uses an insertion-ordered hash-based {@code Set} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
@Override public ImmutableList<ImmutableSet<E>> allEquivalenceClasses() { SetMultimap<Node<E>, E> groupsTmp = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); for (Node<E> elem : elmap.values()) { groupsTmp.put(findRoot(elem), elem.element); } ImmutableList.Builder<ImmutableSet<E>> result = ImmutableList.builder(); for (Set<E> group : asMap(groupsTmp).values()) { result.add(ImmutableSet.copyOf(group)); } return result.build(); }
/** * Uses a {@link LinkedHashSet} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
/** * Returns a multimap whose keys are base directories and whose values are potential locations of * wire profile files. */ Multimap<Path, String> pathsToAttempt(Set<Location> protoLocations) { Multimap<Path, String> result = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); for (Location location : protoLocations) { pathsToAttempt(result, location); } return result; }
/** * Creates a new builder. The returned builder is equivalent to the builder * generated by {@link ImmutableSetMultimap#builder}. */ public Builder() { super(MultimapBuilder.linkedHashKeys().linkedHashSetValues().<K, V> build()); }
/** * Uses a {@link LinkedHashSet} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
/** * Uses a {@link LinkedHashSet} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
synchronized void updateCache() { Multimap<String, Location> newClassNameLocations = HashMultimap.create(); for (ClassLoader loader : getKnownClassLoaders()) { updateCache(loader, newClassNameLocations); } updateCacheWithClasspathClasses(newClassNameLocations); updateCacheWithBootstrapClasses(newClassNameLocations); if (!newClassNameLocations.isEmpty()) { // multimap that sorts keys and de-dups values while maintains value ordering SetMultimap<String, Location> newMap = MultimapBuilder.treeKeys().linkedHashSetValues().build(); newMap.putAll(classNameLocations); newMap.putAll(newClassNameLocations); classNameLocations = ImmutableMultimap.copyOf(newMap); } }
/** Uses an insertion-ordered hash-based {@code Set} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
/** Uses an insertion-ordered hash-based {@code Set} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }
/** * Returns a multimap whose keys are base directories and whose values are potential locations of * wire profile files. */ Multimap<Path, String> pathsToAttempt(Set<Location> protoLocations) { Multimap<Path, String> result = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build(); for (Location location : protoLocations) { pathsToAttempt(result, location); } return result; }
/** Uses an insertion-ordered hash-based {@code Set} to store value collections. */ public SetMultimapBuilder<K0, Object> linkedHashSetValues() { return linkedHashSetValues(DEFAULT_EXPECTED_VALUES_PER_KEY); }