List of usage examples for com.google.common.collect Multimap get
Collection<V> get(@Nullable K key);
From source file:eu.tomylobo.routes.util.Ini.java
public static Vector loadVector(Multimap<String, String> section, String format) { return new Vector(getOnlyDouble(section.get(String.format(format, "x"))), getOnlyDouble(section.get(String.format(format, "y"))), getOnlyDouble(section.get(String.format(format, "z")))); }
From source file:eu.tomylobo.routes.util.Ini.java
public static World loadWorld(Multimap<String, String> section, String format) { final String worldName = getOnlyValue(section.get(String.format(format, "world"))); return worldName.equals("null") ? null : Environment.getWorld(worldName); }
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/*from w ww . ja va 2s .c o m*/ 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:org.gradle.api.internal.tasks.compile.incremental.deps.ClassDependentsAccumulator.java
private static <K, V> Map<K, Set<V>> asMap(Multimap<K, V> multimap) { ImmutableMap.Builder<K, Set<V>> builder = ImmutableMap.builder(); for (K key : multimap.keySet()) { builder.put(key, ImmutableSet.copyOf(multimap.get(key))); }/* w w w.ja v a2 s . c o m*/ return builder.build(); }
From source file:fr.letroll.ttorrentandroid.common.protocol.http.HTTPTrackerMessage.java
@CheckForNull protected static String toString(@Nonnull Multimap<String, String> params, @Nonnull String key, @CheckForNull ErrorMessage.FailureReason error) throws MessageValidationException { LOOKUP: {/*from w ww. j av a 2s . co m*/ Collection<String> texts = params.get(key); if (texts == null) break LOOKUP; if (texts.isEmpty()) break LOOKUP; String text = texts.iterator().next(); if (text == null) break LOOKUP; return text; } if (error != null) throw new MessageValidationException("Invalid parameters " + params + ": " + error.getMessage()); return null; }
From source file:com.google.enterprise.connector.ldap.JsonDocument.java
private static JsonDocument buildJson(Multimap<String, String> person) { JSONObject jo = new JSONObject(); for (String attrname : person.keySet()) { try {//from w w w. ja va 2 s . c o m jo.put(attrname, person.get(attrname)); } catch (JSONException e) { throw new IllegalStateException(); } } return new JsonDocument(jo); }
From source file:grakn.core.graql.gremlin.RelationTypeInference.java
private static Set<Type> getAllPossibleRelationTypes(Collection<Type> instanceVarTypes, Multimap<Type, RelationType> relationMap) { return instanceVarTypes.stream() .map(rolePlayerType -> (Set<Type>) new HashSet<Type>(relationMap.get(rolePlayerType))) .reduce(Sets::intersection).orElse(Collections.emptySet()); }
From source file:com.lithium.flow.matcher.StringMatchers.java
@Nonnull private static List<StringMatcher> buildList(@Nonnull Multimap<String, String> multimap, @Nonnull String group, @Nonnull Function<String, StringMatcher> function) { List<StringMatcher> list = Lists.newArrayList(); multimap.get(group).stream().map(function).forEach(list::add); multimap.get(group + "?").stream().map(input -> buildConditional(input, function)).forEach(list::add); return list;//from w w w .ja v a2s . c o m }
From source file:com.android.tools.idea.apk.viewer.dex.DexParser.java
@NotNull static PackageTreeNode constructMethodRefTreeForDex(@NotNull DexBackedDexFile dexFile) { PackageTreeNode root = new PackageTreeNode("", "root", PackageTreeNode.NodeType.PACKAGE, null); Set<String> classesWithDefinition = dexFile.getClasses().stream().map(DexBackedClassDef::getType) .collect(Collectors.toSet()); Multimap<String, MethodReference> methodsByClassName = getMethodsByClassName(dexFile); for (String className : methodsByClassName.keySet()) { Collection<MethodReference> methods = methodsByClassName.get(className); for (MethodReference ref : methods) { root.insert("", DebuggerUtilsEx.signatureToName(className), ref, classesWithDefinition.contains(className)); }//from w w w . j a v a 2 s . com } root.sortByCount(); return root; }
From source file:edu.sdsc.scigraph.internal.CypherUtil.java
static String substituteRelationships(String query, final Multimap<String, Object> valueMap) { StrSubstitutor substitutor = new StrSubstitutor(new StrLookup<String>() { @Override/*from www.j a va 2 s .co m*/ public String lookup(String key) { return on('|').join(valueMap.get(key)); } }); return substitutor.replace(query); }