List of usage examples for com.google.common.collect Multimap containsKey
boolean containsKey(@Nullable Object key);
From source file:org.jclouds.digitalocean2.functions.LinkToListOptions.java
public static String getFirstOrNull(String key, Multimap<String, String> params) { return params.containsKey(key) ? emptyToNull(getFirst(params.get(key), null)) : null; }
From source file:com.google.devtools.build.xcode.util.Containing.java
public static <K> boolean key(Multimap<K, ?> map, K key) { checkNotNull(key); return map.containsKey(key); }
From source file:org.deephacks.tools4j.config.internal.core.jpa.JpaBeanToBeanConverter.java
private static void collectRefs(JpaBean jpaBean, Multimap<BeanId, JpaBean> result) { if (result.containsKey(jpaBean.getId())) { // break redundant selects and circular recursion return;// w w w. j a v a2s. c o m } for (JpaRef jpaRef : jpaBean.getReferences()) { result.put(jpaBean.getId(), jpaRef.getTargetBean()); collectRefs(jpaRef.getTargetBean(), result); } }
From source file:com.android.tools.idea.gradle.structure.configurables.android.dependencies.module.treeview.DependencyNodes.java
private static void addTransitive(@NotNull PsDependency dependency, @NotNull Multimap<PsDependency, PsDependency> allTransitive) { if (allTransitive.containsKey(dependency)) { return;/*from ww w.j a va 2 s. co m*/ } if (dependency instanceof PsLibraryAndroidDependency) { PsLibraryAndroidDependency libraryDependency = (PsLibraryAndroidDependency) dependency; ImmutableCollection<PsDependency> transitives = libraryDependency.getTransitiveDependencies(); allTransitive.putAll(dependency, transitives); for (PsDependency transitive : transitives) { addTransitive(transitive, allTransitive); } } }
From source file:com.preferanser.shared.util.GameUtils.java
public static Map<Hand, Set<Card>> copyDefensive(Multimap<Hand, Card> handCardMultimap) { ImmutableMap.Builder<Hand, Set<Card>> builder = ImmutableMap.builder(); if (handCardMultimap.containsKey(Hand.EAST)) builder.put(Hand.EAST, ImmutableSet.copyOf(handCardMultimap.get(Hand.EAST))); else//ww w . j a v a2 s .com builder.put(Hand.EAST, ImmutableSet.<Card>of()); if (handCardMultimap.containsKey(Hand.SOUTH)) builder.put(Hand.SOUTH, ImmutableSet.copyOf(handCardMultimap.get(Hand.SOUTH))); else builder.put(Hand.SOUTH, ImmutableSet.<Card>of()); if (handCardMultimap.containsKey(Hand.WEST)) builder.put(Hand.WEST, ImmutableSet.copyOf(handCardMultimap.get(Hand.WEST))); else builder.put(Hand.WEST, ImmutableSet.<Card>of()); return builder.build(); }
From source file:io.soliton.shapeshifter.ProtoDescriptorGraph.java
private static void populate(Descriptor descriptor, Multimap<Descriptor, Descriptor> graphBuilder) { if (graphBuilder.containsKey(descriptor)) { return;// w w w . j av a 2s.c o m } for (FieldDescriptor field : descriptor.getFields()) { if (Type.MESSAGE.equals(field.getType())) { Descriptors.Descriptor subDescriptor = field.getMessageType(); graphBuilder.put(descriptor, subDescriptor); populate(subDescriptor, graphBuilder); } } }
From source file:tterrag.potionapi.common.util.ReplaceUtil.java
public static void overwriteEntry(RegistryNamespaced registry, String name, Object object) { Object oldThing = registry.getObject(name); Repl.overwrite_do(registry, name, object, oldThing); Multimap<String, Object> reg = Repl.replacements.get(registry); if (reg == null) { Repl.replacements.put(registry, reg = ArrayListMultimap.create()); }//from ww w . j a v a2 s .c o m if (!reg.containsKey(name)) { reg.put(name, oldThing); } reg.put(name, object); Repl.alterDelegateChain(registry, name, object); }
From source file:org.eclipse.viatra.addon.validation.runtime.ConstraintExtensionRegistry.java
/** * Returns whether there are constraint specifications registered for an editor Id. * //from w ww . j ava2 s . co m * @param editorId * The editor Id which should be checked * @return <code>true</code> if there are registered constraint specifications */ public static synchronized boolean isConstraintSpecificationsRegisteredForEditorId(String editorId) { Multimap<String, IProvider<IConstraintSpecification>> specificationMap = getEditorConstraintSpecificationMap(); if (specificationMap.containsKey(WILDCARD_EDITOR_ID)) { return true; } return specificationMap.containsKey(editorId); }
From source file:org.glowroot.agent.model.TraceEntryComponent.java
private static List<Trace.Entry> getProtobufChildEntries(TraceEntryImpl entry, Multimap<TraceEntryImpl, TraceEntryImpl> parentChildMap, long transactionStartTick, long captureTick) { if (!parentChildMap.containsKey(entry)) { return ImmutableList.of(); }/* w w w .jav a 2 s . c o m*/ Collection<TraceEntryImpl> childEntries = parentChildMap.get(entry); List<Trace.Entry> protobufChildEntries = Lists.newArrayListWithCapacity(childEntries.size()); for (TraceEntryImpl childEntry : childEntries) { List<Trace.Entry> subChildEntries = getProtobufChildEntries(childEntry, parentChildMap, transactionStartTick, captureTick); protobufChildEntries.add(childEntry.toProto(transactionStartTick, captureTick, subChildEntries)); } return protobufChildEntries; }
From source file:org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions.java
/** * get a task editor extension for a specific task attribute * /*from w w w . jav a 2s .c o m*/ * @param taskRepository * @param taskAttribute * @return the extension, or null if there is none * @see #getTaskEditorExtension(TaskRepository); * @since 3.11 */ public static AbstractTaskEditorExtension getTaskEditorExtension(TaskRepository taskRepository, TaskAttribute taskAttribute) { init(); String input = taskAttribute.getMetaData().getMediaType(); if (input != null) { try { MediaType media = MediaType.parse(input); Multimap<String, String> parameters = media.parameters(); if (parameters.containsKey(MARKUP_KEY)) { Iterator<String> iter = parameters.get(MARKUP_KEY).iterator(); String markup = iter.next(); SortedSet<RegisteredTaskEditorExtension> extensions = getTaskEditorExtensions(); for (RegisteredTaskEditorExtension extension : extensions) { if (markup.equals(extension.getName())) { return extension.getExtension(); } } } } catch (IllegalArgumentException e) { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, String.format("Unable to parse markup type for attribute %s", taskAttribute.toString()), //$NON-NLS-1$ e)); } } return getTaskEditorExtension(taskRepository); }