當前位置: 首頁>>代碼示例>>Java>>正文


Java LinkedHashMultimap.create方法代碼示例

本文整理匯總了Java中com.google.common.collect.LinkedHashMultimap.create方法的典型用法代碼示例。如果您正苦於以下問題:Java LinkedHashMultimap.create方法的具體用法?Java LinkedHashMultimap.create怎麽用?Java LinkedHashMultimap.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.LinkedHashMultimap的用法示例。


在下文中一共展示了LinkedHashMultimap.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPluginManager

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
public static PluginManager createPluginManager(String pluginFileName) {

    try {
      SetMultimap<String, Class<?>> info = LinkedHashMultimap.create();
      Enumeration<URL> resourcesFiles = PluginManager.class.getClassLoader().getResources(pluginFileName);

      while (resourcesFiles.hasMoreElements()) {
        URL url = resourcesFiles.nextElement();
        Properties properties = new Properties();
        loadProperties(url, properties);
        buildPluginNames(info, properties);
      }

      return new PluginManager(info);

    } catch (IOException e) {

      throw new GenerationException(e);
    }

  }
 
開發者ID:mulesoft-labs,項目名稱:raml-java-tools,代碼行數:22,代碼來源:PluginManager.java

示例2: checkConstructorInitialization

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
/**
 * @param entities field init info
 * @param state visitor state
 * @return a map from each constructor C to the nonnull fields that C does *not* initialize
 */
private SetMultimap<MethodTree, Symbol> checkConstructorInitialization(
    FieldInitEntities entities, VisitorState state) {
  SetMultimap<MethodTree, Symbol> result = LinkedHashMultimap.create();
  Set<Symbol> nonnullInstanceFields = entities.nonnullInstanceFields();
  Trees trees = Trees.instance(JavacProcessingEnvironment.instance(state.context));
  for (MethodTree constructor : entities.constructors()) {
    if (constructorInvokesAnother(constructor, state)) {
      continue;
    }
    Set<Element> guaranteedNonNull =
        guaranteedNonNullForConstructor(entities, state, trees, constructor);
    for (Symbol fieldSymbol : nonnullInstanceFields) {
      if (!guaranteedNonNull.contains(fieldSymbol)) {
        result.put(constructor, fieldSymbol);
      }
    }
  }
  return result;
}
 
開發者ID:uber,項目名稱:NullAway,代碼行數:25,代碼來源:NullAway.java

示例3: identifyDuplicates

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
private void identifyDuplicates(List<ModContainer> mods)
{
    TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
    for (ModContainer mc : mods)
    {
        if (mc.getSource() != null)
        {
            dupsearch.put(mc, mc.getSource());
        }
    }

    ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
    SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
    for (Entry<ModContainer> e : duplist.entrySet())
    {
        if (e.getCount() > 1)
        {
            FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
            dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
        }
    }
    if (!dupes.isEmpty())
    {
        throw new DuplicateModsFoundException(dupes);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:Loader.java

示例4: readKeys

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
/**
 * Read Semeval keys file.
 *
 * @param path path to keys file
 * @return map from sense IDs onto senses
 */
private static SetMultimap<String, String> readKeys(String path) {
    try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
        SetMultimap<String, String> keys = LinkedHashMultimap.create();
        String line;
        while ((line = reader.readLine()) != null) {
            if (line.isEmpty()) {
                continue;
            }
            String[] fields = line.split(" ");
            for (int i = 1; i < fields.length; ++i) {
                keys.put(fields[0], fields[i]);
            }
        }
        return keys;
    } catch (IOException e) {
        throw new RuntimeException("Error reading sense keys file", e);
    }
}
 
開發者ID:clearwsd,項目名稱:clearwsd,代碼行數:25,代碼來源:SemevalReader.java

示例5: computeAllOperations

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
protected List<IResolvedOperation> computeAllOperations() {
	JvmType rawType = getRawType();
	if (!(rawType instanceof JvmDeclaredType)) {
		return Collections.emptyList();
	}
	Multimap<String, AbstractResolvedOperation> processedOperations = LinkedHashMultimap.create();
	for (IResolvedOperation resolvedOperation : getDeclaredOperations()) {
		processedOperations.put(resolvedOperation.getDeclaration().getSimpleName(), (AbstractResolvedOperation) resolvedOperation);
	}
	if (targetVersion.isAtLeast(JavaVersion.JAVA8)) {
		computeAllOperationsFromSortedSuperTypes((JvmDeclaredType) rawType, processedOperations);
	} else {
		Set<JvmType> processedTypes = Sets.newHashSet(rawType);
		computeAllOperationsFromSuperTypes((JvmDeclaredType) rawType, processedOperations, processedTypes);
	}
	// make sure the declared operations are the first in the list
	List<IResolvedOperation> result = new ArrayList<IResolvedOperation>(processedOperations.size());
	result.addAll(getDeclaredOperations());
	for (AbstractResolvedOperation operation : processedOperations.values()) {
		if (operation.getDeclaration().getDeclaringType() != rawType) {
			result.add(operation);
		}
	}
	return Collections.unmodifiableList(result);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:26,代碼來源:ResolvedFeatures.java

示例6: after

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
public void after(EObject grammarElement) {
	EObject foundGrammarElement = removeLast(grammarElements);
	if (grammarElement != foundGrammarElement)
		throw new IllegalStateException(
				"expected element: '" + grammarElement + "', but was: '" + foundGrammarElement + "'");
	if (grammarElement instanceof UnorderedGroup && indexToHandledElements != null) {
		indexToHandledElements.removeAll(grammarElements.size());
	} else if (!grammarElements.isEmpty()) {
		int index = grammarElements.size() - 1;
		if (grammarElements.get(index) instanceof UnorderedGroup) {
			if (indexToHandledElements == null) {
				indexToHandledElements = LinkedHashMultimap.create();
			}
			indexToHandledElements.put(index, (AbstractElement) grammarElement);
		}
	}
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:18,代碼來源:BaseInternalContentAssistParser.java

示例7: getAliasedElements

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
protected Iterable<IEObjectDescription> getAliasedElements(Iterable<IEObjectDescription> candidates) {
	Multimap<QualifiedName, IEObjectDescription> keyToDescription = LinkedHashMultimap.create();
	Multimap<QualifiedName, ImportNormalizer> keyToNormalizer = HashMultimap.create();

	for (IEObjectDescription imported : candidates) {
		QualifiedName fullyQualifiedName = imported.getName();
		for (ImportNormalizer normalizer : normalizers) {
			QualifiedName alias = normalizer.deresolve(fullyQualifiedName);
			if (alias != null) {
				QualifiedName key = alias;
				if (isIgnoreCase()) {
					key = key.toLowerCase();
				}
				keyToDescription.put(key, new AliasedEObjectDescription(alias, imported));
				keyToNormalizer.put(key, normalizer);
			}
		}
	}
	for (QualifiedName name : keyToNormalizer.keySet()) {
		if (keyToNormalizer.get(name).size() > 1)
			keyToDescription.removeAll(name);
	}
	return keyToDescription.values();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:25,代碼來源:ImportScope.java

示例8: groupByRelatedSourceEvents

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
/**
 * Returns the group of correlated events per source where the group of related source events
 * produces the same downstream events
 *
 * @param sources the set of source component names
 * @return the group of correlated events per source
 */
public List<Set<String>> groupByRelatedSourceEvents(Set<String> sources) {
    Multimap<Set<String>, String> allEventsToSourceEvents = LinkedHashMultimap.create();
    Stream<String> rootEventIds = events.stream().filter(e -> e != null && e.getRootIds().isEmpty())
            .map(EventInformation::getEventId);
    rootEventIds.forEach(rootEventId -> {
        Map<String, EventInformation> allRelatedEvents = buildRelatedEventsMap(rootEventId);
        allEventsToSourceEvents.put(allRelatedEvents.keySet(), rootEventId);
    });

    List<Set<String>> result = new ArrayList<>();
    allEventsToSourceEvents.asMap().values().forEach(v ->
            result.add(new HashSet<>(v))
    );

    return result;
}
 
開發者ID:hortonworks,項目名稱:streamline,代碼行數:24,代碼來源:CorrelatedEventsGrouper.java

示例9: groupOperationsByTag

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
/**
 * Groups the operations by tag. The key of the Multimap is the tag name.
 * The value of the Multimap is a PathOperation
 *
 * @param allOperations     all operations
 * @param operationOrdering comparator for operations, for a given tag
 * @return Operations grouped by Tag
 */
public static Multimap<String, PathOperation> groupOperationsByTag(List<PathOperation> allOperations, Comparator<PathOperation> operationOrdering) {

    Multimap<String, PathOperation> operationsGroupedByTag;
    if (operationOrdering == null) {
        operationsGroupedByTag = LinkedHashMultimap.create();
    } else {
        operationsGroupedByTag = MultimapBuilder.linkedHashKeys().treeSetValues(operationOrdering).build();
    }
    for (PathOperation operation : allOperations) {
        List<String> tags = operation.getOperation().getTags();

        Validate.notEmpty(tags, "Can't GroupBy.TAGS. Operation '%s' has no tags", operation);
        for (String tag : tags) {
            if (logger.isDebugEnabled()) {
                logger.debug("Added path operation '{}' to tag '{}'", operation, tag);
            }
            operationsGroupedByTag.put(tag, operation);
        }
    }

    return operationsGroupedByTag;
}
 
開發者ID:Swagger2Markup,項目名稱:swagger2markup,代碼行數:31,代碼來源:TagUtils.java

示例10: process

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public boolean process(MorphDictionary dict, Lemma.Builder lemmaBuilder,
                       Multimap<String, Wordform> wfMap) {
    Multimap<String, Wordform> additionalWfs = LinkedHashMultimap.create();
    for (String wfStr : wfMap.keySet()) {
        // alternative wordform string
        String altStr = StringUtils.replaceChars(wfStr, YO_CHARS, YO_REPLACEMENTS);
        if (Objects.equal(wfStr, altStr)) {
            continue;
        } // else wfStr contains 'yo'
        if (wfMap.containsKey(altStr)) {
            // the wordform multimap already contains string without 'yo'
            continue;
        }
        additionalWfs.putAll(altStr, wfMap.get(wfStr));
    }
    wfMap.putAll(additionalWfs);
    return true;
}
 
開發者ID:textocat,項目名稱:textokit-core,代碼行數:23,代碼來源:YoLemmaPostProcessor.java

示例11: populateArtifactsFromDescriptor

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
private void populateArtifactsFromDescriptor() {
    Map<Artifact, ModuleComponentArtifactMetaData> artifactToMetaData = Maps.newLinkedHashMap();
    for (Artifact descriptorArtifact : getDescriptor().getAllArtifacts()) {
        ModuleComponentArtifactMetaData artifact = artifact(descriptorArtifact);
        artifactToMetaData.put(descriptorArtifact, artifact);
    }

    artifacts = Sets.newLinkedHashSet(artifactToMetaData.values());

    this.artifactsByConfig = LinkedHashMultimap.create();
    for (String configuration : getDescriptor().getConfigurationsNames()) {
        Artifact[] configArtifacts = getDescriptor().getArtifacts(configuration);
        for (Artifact configArtifact : configArtifacts) {
            artifactsByConfig.put(configuration, artifactToMetaData.get(configArtifact));
        }
    }
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:18,代碼來源:AbstractModuleComponentResolveMetaData.java

示例12: validateImportsOf

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
public static LinkedHashMultimap<String, GamlResource> validateImportsOf(final GamlResource resource) {
	final TOrderedHashMap<URI, String> uris = allLabeledImportsOf(resource);
	uris.remove(GamlResourceServices.properlyEncodedURI(resource.getURI()));
	if (!uris.isEmpty()) {
		final LinkedHashMultimap<String, GamlResource> imports = LinkedHashMultimap.create();
		if (uris.forEachEntry((a, b) -> {
			final GamlResource r = (GamlResource) resource.getResourceSet().getResource(a, true);
			if (r.hasErrors()) {
				resource.invalidate(r, "Errors detected");
				return false;
			}
			imports.put(b, r);
			return true;
		}))
			return imports;

	}
	return null;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:20,代碼來源:GamlResourceIndexer.java

示例13: methodsOn

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
/**
 * Returns all methods, declared and inherited, on {@code type}, except those specified by
 * {@link Object}.
 *
 * <p>If method B overrides method A, only method B will be included in the return set.
 * Additionally, if methods A and B have the same signature, but are on unrelated interfaces,
 * one will be arbitrarily picked to be returned.
 */
public static ImmutableSet<ExecutableElement> methodsOn(TypeElement type, Elements elements)
    throws CannotGenerateCodeException {
  TypeElement objectType = elements.getTypeElement(Object.class.getCanonicalName());
  SetMultimap<Signature, ExecutableElement> methods = LinkedHashMultimap.create();
  for (TypeElement supertype : getSupertypes(type)) {
    for (ExecutableElement method : methodsIn(supertype.getEnclosedElements())) {
      if (method.getEnclosingElement().equals(objectType)) {
        continue;  // Skip methods specified by Object.
      }
      Signature signature = new Signature(method);
      Iterator<ExecutableElement> iterator = methods.get(signature).iterator();
      while (iterator.hasNext()) {
        ExecutableElement otherMethod = iterator.next();
        if (elements.overrides(method, otherMethod, type)
            || method.getParameters().equals(otherMethod.getParameters())) {
          iterator.remove();
        }
      }
      methods.put(signature, method);
    }
  }
  return ImmutableSet.copyOf(methods.values());
}
 
開發者ID:google,項目名稱:FreeBuilder,代碼行數:32,代碼來源:MethodFinder.java

示例14: buildHandCardMultimap

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
private LinkedHashMultimap<Hand, Card> buildHandCardMultimap() {
    LinkedHashMultimap<Hand, Card> multimap = LinkedHashMultimap.create();

    multimap.put(EAST, CLUB_8);
    multimap.put(EAST, SPADE_8);
    multimap.put(EAST, DIAMOND_7);
    multimap.put(EAST, DIAMOND_8);

    multimap.put(SOUTH, CLUB_ACE);
    multimap.put(SOUTH, CLUB_KING);
    multimap.put(SOUTH, DIAMOND_9);
    multimap.put(SOUTH, DIAMOND_10);

    multimap.put(WEST, CLUB_JACK);
    multimap.put(WEST, CLUB_9);
    multimap.put(WEST, HEART_JACK);
    multimap.put(WEST, DIAMOND_JACK);
    multimap.put(WEST, DIAMOND_QUEEN);

    return multimap;
}
 
開發者ID:Unisay,項目名稱:preferanser,代碼行數:22,代碼來源:PlayerTest.java

示例15: convertToMap

import com.google.common.collect.LinkedHashMultimap; //導入方法依賴的package包/類
private static Multimap<String, Map<String, Object>> convertToMap(Multimap<String, FormValueElement> subElements) {
    Multimap<String, Map<String, Object>> elements = LinkedHashMultimap.create();

    for (Map.Entry<String, FormValueElement> entry : subElements.entries()) {
        Map<String, Object> elementAsMap = new HashMap<>(4); // NO CHECKSTYLE MagicNumber
        FormValueElement formValueElement = entry.getValue();

        elementAsMap.put(ELEMENT_NAME, formValueElement.getElementName());
        elementAsMap.put(SUB_ELEMENTS, convertToMap(formValueElement.getSubElements()));
        elementAsMap.put(ATTRIBUTES, formValueElement.getAttributes());
        elementAsMap.put(VALUE, formValueElement.getValue());

        elements.put(entry.getKey(), elementAsMap);
    }

    return elements;
}
 
開發者ID:motech,項目名稱:modules,代碼行數:18,代碼來源:FullFormEvent.java


注:本文中的com.google.common.collect.LinkedHashMultimap.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。