List of usage examples for com.google.common.collect ImmutableMultimap of
public static <K, V> ImmutableMultimap<K, V> of()
From source file:com.google.devtools.build.lib.query2.output.ConservativeAspectResolver.java
@Override public ImmutableMultimap<Attribute, Label> computeAspectDependencies(Target target, DependencyFilter dependencyFilter) throws InterruptedException { if (!(target instanceof Rule)) { return ImmutableMultimap.of(); }//from w ww . ja v a 2 s. com Rule rule = (Rule) target; Multimap<Attribute, Label> result = LinkedHashMultimap.create(); for (Attribute attribute : rule.getAttributes()) { for (Aspect aspect : attribute.getAspects(rule)) { AspectDefinition.addAllAttributesOfAspect(rule, result, aspect, dependencyFilter); } } return ImmutableMultimap.copyOf(result); }
From source file:org.sosy_lab.cpachecker.core.defaults.precision.LocalizedRefinablePrecision.java
LocalizedRefinablePrecision(VariableTrackingPrecision pBaseline) { super(pBaseline); rawPrecision = ImmutableMultimap.of(); }
From source file:org.jclouds.rest.functions.ReturnEmptyMultimapOnNotFoundOr404.java
public Object apply(Exception from) { Iterable<ResourceNotFoundException> throwables = Iterables.filter(Throwables.getCausalChain(from), ResourceNotFoundException.class); if (Iterables.size(throwables) >= 1) { return ImmutableMultimap.of(); } else if (rto404.apply(from)) { return ImmutableMultimap.of(); }/*from ww w. j a va2 s .com*/ return Multimap.class.cast(propagateOrNull(from)); }
From source file:org.gradle.internal.fingerprint.impl.EmptyHistoricalFileCollectionFingerprint.java
public Multimap<String, HashCode> getRootHashes() { return ImmutableMultimap.of(); }
From source file:com.isotrol.impe3.core.engine.ImmutableRenderContext.java
ImmutableRenderContext(final ComponentRequestContext delegate, final Integer width, final Multimap<String, String> query) { this.delegate = checkNotNull(delegate); this.width = width; if (query == null) { this.query = ImmutableMultimap.of(); } else {// www . ja va2 s. c o m this.query = ImmutableMultimap.copyOf(query); } }
From source file:org.lttng.scope.lami.core.LamiAnalysisStub.java
@Override protected @NonNull Multimap<@NonNull String, @NonNull LamiChartModel> getPredefinedCharts() { return ImmutableMultimap.of(); }
From source file:com.isotrol.impe3.core.support.RouteParams.java
public static Multimap<String, String> toParams(UUID csrfToken, Route route) { if (route == null) { return ImmutableMultimap.of(); }/*from w w w .ja v a 2 s . c o m*/ final PageKey key = route.getPage(); if (key == null) { return ImmutableMultimap.of(); } Multimap<String, String> p = ArrayListMultimap.create(); if (route.isSecure()) { p.put(SECURE, ""); } // The pk will only be an error page in case no page was resolved, so we turn to the main page if (key == PageKey.main() || key instanceof ErrorPage) { p.put(TYPE, TYPE_M); } else if (key instanceof Special) { p.put(TYPE, TYPE_S); p.put(NAME, ((Special) key).getName().toString()); } else if (key instanceof WithNavigation) { WithNavigation wn = (WithNavigation) key; final NavigationKey nk = wn.getNavigationKey(); if (nk != null) { if (nk.isCategory()) { p.put(CATEGORY, nk.getCategory().getId().toString()); } else if (nk.isTag()) { p.put(TAG, nk.getTag()); } if (nk.isContentType()) { p.put(TYPE, TYPE_L); p.put(CONTENT_TYPE, nk.getContentType().getId().toString()); } } if (wn instanceof NavigationPage) { p.put(TYPE, TYPE_N); } else if (wn instanceof ContentPage) { ContentPage cp = (ContentPage) key; final ContentKey ck = cp.getContentKey(); p.put(CONTENT_TYPE, ck.getContentType().getId().toString()); p.put(CONTENT_ID, ck.getContentId()); p.put(TYPE, TYPE_C); } } final Locale locale = route.getLocale(); if (locale != null) { p.put(LOCALE, locale.toString()); } final Device device = route.getDevice(); if (device != null) { p.put(DEVICE, device.getId().toString()); } if (csrfToken != null) { p.put(SESSIONCSRF, csrfToken.toString()); } return p; }
From source file:org.jboss.errai.ui.nav.client.local.api.NavigationControl.java
/** * Redirect to a given page safely.// w ww .j av a 2 s .c o m * * @param toPage Page class annotated with {@link org.jboss.errai.ui.nav.client.local.Page}. */ public <C> void redirect(final Class<C> toPage) { redirect(toPage, ImmutableMultimap.of()); }
From source file:com.b2international.snowowl.datastore.server.snomed.ModuleDependencyCollector.java
public Multimap<String, String> getModuleDependencies(Iterable<Long> storageKeys) throws IOException { if (Iterables.isEmpty(storageKeys)) { return ImmutableMultimap.of(); }//from ww w . j av a 2s . co m final Multimap<String, String> moduleDependencies = HashMultimap.create(); final Multimap<String, String> componentIdsByReferringModule = HashMultimap.create(); collectConceptModuleDependencies(storageKeys, componentIdsByReferringModule); collectDescriptionModuleDependencies(storageKeys, componentIdsByReferringModule); collectRelationshipModuleDependencies(storageKeys, componentIdsByReferringModule); collectMemberModuleDependencies(storageKeys, componentIdsByReferringModule); // iterate over each module and get modules of all components registered to componentsByReferringModule for (String module : ImmutableSet.copyOf(componentIdsByReferringModule.keySet())) { final Collection<String> dependencies = componentIdsByReferringModule.removeAll(module); for (Class<? extends SnomedComponentDocument> type : CORE_COMPONENT_TYPES) { Query<String[]> dependencyQuery = Query.select(String[].class).from(type) .fields(SnomedComponentDocument.Fields.ID, SnomedComponentDocument.Fields.MODULE_ID) .where(SnomedComponentDocument.Expressions.ids(dependencies)).limit(10000).build(); for (Hits<String[]> dependencyHits : searcher.scroll(dependencyQuery)) { for (String[] idAndModule : dependencyHits) { String targetModule = idAndModule[1]; if (!module.equals(targetModule)) { moduleDependencies.put(module, targetModule); } } } } } return moduleDependencies; }
From source file:com.exoplatform.iversion.Merge.java
public <M, T extends Version<K, V, M>> Merge(Iterable<VersionNode<K, V, M, T>> versions) { checkNotNull(versions, "versions"); Iterator<VersionNode<K, V, M, T>> iter = versions.iterator(); // No versions if (!iter.hasNext()) { mergedProperties = ImmutableMap.of(); revisions = ImmutableSet.of();/*w w w .j a v a2 s. c o m*/ conflicts = ImmutableMultimap.of(); } else { VersionNode<K, V, M, T> versionNode = next(iter); // One version if (!iter.hasNext()) { mergedProperties = versionNode.getProperties(); revisions = ImmutableSet.of(versionNode.getRevision()); conflicts = ImmutableMultimap.of(); } // More than one version -> merge! else { Map<K, VersionProperty<V>> mergedProperties = Maps.newLinkedHashMap(versionNode.getProperties()); Set<Long> heads = Sets.newHashSet(versionNode.getRevision()); ImmutableMultimap.Builder<K, VersionProperty<V>> conflicts = ImmutableMultimap.builder(); Set<Long> mergedRevisions = Sets.newHashSet(versionNode.getRevisions()); do { versionNode = next(iter); // Version already merged? if (!mergedRevisions.contains(versionNode.getRevision())) { for (Map.Entry<K, VersionProperty<V>> entry : versionNode.getProperties().entrySet()) { K key = entry.getKey(); VersionProperty<V> nextValue = entry.getValue(); // nextValue derives from common ancestor? if (!mergedRevisions.contains(nextValue.revision)) { VersionProperty<V> previousValue = mergedProperties.get(key); // New value if (previousValue == null) { mergedProperties.put(key, nextValue); } // Conflicting value? else if (!equal(previousValue.value, nextValue.value)) { conflicts.put(key, nextValue); } } } mergedRevisions.addAll(versionNode.getRevisions()); heads.removeAll(versionNode.getRevisions()); heads.add(versionNode.getRevision()); } } while (iter.hasNext()); this.mergedProperties = unmodifiableMap(mergedProperties); this.revisions = unmodifiableSet(heads); this.conflicts = conflicts.build(); } } }