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


Java Multimap.get方法代碼示例

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


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

示例1: corrigeerIdentiteitrecordsMetVervallenStandaard

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void corrigeerIdentiteitrecordsMetVervallenStandaard(final Multimap<MetaObject, MetaRecord> records) {
    final HashSet<MetaObject> copySet = Sets.newHashSet(records.keySet());
    for (MetaObject metaObject : copySet) {
        boolean heeftIdentiteitGroepZonderHistorie = metaObject.getObjectElement().getGroepen().stream().anyMatch(groepElement ->
                groepElement.isIdentiteitGroep() && groepElement.getHistoriePatroon() == HistoriePatroon.G);
        boolean heeftStandaardGroepMetHistorie = metaObject.getObjectElement().getGroepen().stream().anyMatch(groepElement ->
                groepElement.isStandaardGroep() && groepElement.getHistoriePatroon() != HistoriePatroon.G);
        if (heeftIdentiteitGroepZonderHistorie && heeftStandaardGroepMetHistorie) {
            //is er een actueel standaard record
            final Collection<MetaRecord> recordsVanObject = records.get(metaObject);
            boolean actueelStandaardRecord = recordsVanObject.stream().anyMatch(metaRecord -> metaRecord.getParentGroep().getGroepElement()
                    .isStandaardGroep());
            if (!actueelStandaardRecord) {
                records.removeAll(metaObject);
            }
        }
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:19,代碼來源:ActueelBepaling.java

示例2: sortByListSize

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/** Sorts a {@link Multimap} based on the length of each value list */
static public <E extends Comparable<E>, T extends Comparable<T>> TreeMap<T, Collection<E>> sortByListSize(
		Multimap<T, E> multimap) {

	Comparator<T> comparator = new Comparator<T>() {
		@Override
		public int compare(T t1, T t2) {
			int s1 = multimap.get(t1).size();
			int s2 = multimap.get(t2).size();
			if (s2 != s1)
				return s2 - s1;
			return t1.compareTo(t2);
		}
	};
	TreeMap<T, Collection<E>> sortedMap = new TreeMap<>(comparator);
	for (T key : multimap.keySet()) {
		Collection<E> elems = multimap.get(key);
		sortedMap.put(key, elems);
	}

	return sortedMap;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:ReportUtils.java

示例3: createOptions

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
 * Turn this Multimap into a two-dimensional array the first index giving the page, second the choices of this page.
 *
 * @param multimap
 *            name to many options
 * @return two-dim Array of T
 */
public static <T> Object[][] createOptions(Multimap<String, T> multimap) {
	Object[][] result = new Object[multimap.keySet().size()][];

	int page = 0;
	for (String key : multimap.keySet()) {
		Collection<T> values = multimap.get(key);
		result[page] = new Object[values.size()];
		int valueIndex = 0;
		for (T value : values) {
			result[page][valueIndex] = value;
			valueIndex++;
		}
		page++;
	}

	return result;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:25,代碼來源:Multimaps3.java

示例4: computeBuildOrderDepthFirst

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
 * Recursive part of {@link #computeBuildOrderDepthFirst(Map, Multimap, Multimap, Collection)}. If all dependencies
 * of the given project have already been processed, it is added to the build order. Then, all projects that depend
 * on the given project are processed recursively.
 *
 * @param project
 *            the project to process
 * @param markedProjects
 *            the marked projects
 * @param pendencies
 *            maps projects to the projects that depend on them
 * @param dependencies
 *            maps projects to the projects they depend on
 * @param result
 *            the build order being computed
 */
private static void computeBuildOrderDepthFirst(IN4JSProject project,
		Map<IN4JSProject, MarkedProject> markedProjects, Multimap<IN4JSProject, IN4JSProject> pendencies,
		Multimap<IN4JSProject, IN4JSProject> dependencies, List<MarkedProject> result) {

	// once all dependencies of the current project have been processed, we can add it to the build and
	// process its children.
	if (dependencies.get(project).isEmpty()) {
		// The current project is ready to be processed.
		result.add(markedProjects.get(project));

		// Remove this project from the dependencies of all pending projects.
		for (IN4JSProject dependentProject : pendencies.get(project)) {
			dependencies.get(dependentProject).remove(project);

			// Now process the pending project itself.
			computeBuildOrderDepthFirst(dependentProject, markedProjects, pendencies, dependencies, result);
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:36,代碼來源:N4HeadlessCompiler.java

示例5: addToResultsTopDown

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void addToResultsTopDown(Multimap<Long, T> parent2Nodes, Long parentId)
{
	if( !parent2Nodes.containsKey(parentId) )
	{
		return;
	}

	Collection<T> nodes = parent2Nodes.get(parentId);
	results.addAll(nodes);

	for( T node : nodes )
	{
		// Recurse on child nodes
		addToResultsTopDown(parent2Nodes, node.getId());
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:17,代碼來源:SingleTreeNodeFileImportHandler.java

示例6: canonicalizeResponseSet

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
 * Maps a {@code Set<Response>} to a {@code Set<TypeRoleFillerRealis>} which is supported by
 * exactly the same responses.  If any response supporting a TRFR is present in {@code
 * responseGroup}, that TRFR will appear in the returned set. However, if such a TRFR is supported
 * by responses but within and outside {@code responseSet}, an {@link
 * java.lang.IllegalArgumentException} is thrown.
 */
private static ImmutableSet<TypeRoleFillerRealis> canonicalizeResponseSet(
    Set<Response> responseGroup,
    Multimap<TypeRoleFillerRealis, Response> canonicalToResponses,
    Multimap<Response, TypeRoleFillerRealis> responsesToCanonical)
    throws InconsistentLinkingException {
  final ImmutableSet.Builder<TypeRoleFillerRealis> canonicalizationsWithResponsesInGroupBuilder =
      ImmutableSet.builder();
  for (final Response response : responseGroup) {
    for (final TypeRoleFillerRealis canonicalization : responsesToCanonical.get(response)) {
      canonicalizationsWithResponsesInGroupBuilder.add(canonicalization);
    }
  }

  return canonicalizationsWithResponsesInGroupBuilder.build();
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:23,代碼來源:ExactMatchEventArgumentLinkingAligner.java

示例7: replaceModifier

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
 * Replace a modifier in the {@link Multimap} with a copy that's had {@code multiplier} applied to its value.
 *
 * @param modifierMultimap The MultiMap
 * @param attribute        The attribute being modified
 * @param id               The ID of the modifier
 * @param multiplier       The multiplier to apply
 */
private void replaceModifier(Multimap<String, AttributeModifier> modifierMultimap, IAttribute attribute, UUID id, double multiplier) 
{
	// Get the modifiers for the specified attribute
	final Collection<AttributeModifier> modifiers = modifierMultimap.get(attribute.getName());
	// Find the modifier with the specified ID, if any
	final Optional<AttributeModifier> modifierOptional = modifiers.stream().filter(attributeModifier -> attributeModifier.getID().equals(id)).findFirst();

	if (modifierOptional.isPresent()) // If it exists,
	{
		final AttributeModifier modifier = modifierOptional.get();
		modifiers.remove(modifier); // Remove it
		modifiers.add(new AttributeModifier(modifier.getID(), modifier.getName(), modifier.getAmount() * multiplier, modifier.getOperation())); // Add the new modifier
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:23,代碼來源:ItemLEAdvancedMelee.java

示例8: logSummaryOfDuplicates

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void logSummaryOfDuplicates( Multimap<Collection<File>, String> overlapping )
{
    for ( Collection<File> jarz : overlapping.keySet() )
    {
        List<String> jarzS = new LinkedList<String>();

        for ( File jjar : jarz )
        {
            jarzS.add( jjar.getName() );
        }

        List<String> classes = new LinkedList<String>();

        for ( String clazz : overlapping.get( jarz ) )
        {
            classes.add( clazz.replace( ".class", "" ).replace( "/", "." ) );
        }

        //CHECKSTYLE_OFF: LineLength
        getLogger().warn(
            Joiner.on( ", " ).join( jarzS ) + " define " + classes.size() + " overlapping classes: " );
        //CHECKSTYLE_ON: LineLength

        int max = 10;

        for ( int i = 0; i < Math.min( max, classes.size() ); i++ )
        {
            getLogger().warn( "  - " + classes.get( i ) );
        }

        if ( classes.size() > max )
        {
            getLogger().warn( "  - " + ( classes.size() - max ) + " more..." );
        }

    }
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:38,代碼來源:DefaultShader.java

示例9: getApolloConfigNotifications

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private List<ApolloConfigNotification> getApolloConfigNotifications(Set<String> namespaces,
                                                                    Map<String, Long> clientSideNotifications,
                                                                    Multimap<String, String> watchedKeysMap,
                                                                    List<ReleaseMessage> latestReleaseMessages) {
  List<ApolloConfigNotification> newNotifications = Lists.newArrayList();
  if (!CollectionUtils.isEmpty(latestReleaseMessages)) {
    Map<String, Long> latestNotifications = Maps.newHashMap();
    for (ReleaseMessage releaseMessage : latestReleaseMessages) {
      latestNotifications.put(releaseMessage.getMessage(), releaseMessage.getId());
    }

    for (String namespace : namespaces) {
      long clientSideId = clientSideNotifications.get(namespace);
      long latestId = ConfigConsts.NOTIFICATION_ID_PLACEHOLDER;
      Collection<String> namespaceWatchedKeys = watchedKeysMap.get(namespace);
      for (String namespaceWatchedKey : namespaceWatchedKeys) {
        long namespaceNotificationId =
            latestNotifications.getOrDefault(namespaceWatchedKey, ConfigConsts.NOTIFICATION_ID_PLACEHOLDER);
        if (namespaceNotificationId > latestId) {
          latestId = namespaceNotificationId;
        }
      }
      if (latestId > clientSideId) {
        ApolloConfigNotification notification = new ApolloConfigNotification(namespace, latestId);
        namespaceWatchedKeys.stream().filter(latestNotifications::containsKey).forEach(namespaceWatchedKey ->
            notification.addMessage(namespaceWatchedKey, latestNotifications.get(namespaceWatchedKey)));
        newNotifications.add(notification);
      }
    }
  }
  return newNotifications;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:33,代碼來源:NotificationControllerV2.java

示例10: translateColumnName

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
 * 根據名字在manager配置的映射關係,轉化為目標的字段名字
 */
private String translateColumnName(String srcColumnName, DataMediaPair dataMediaPair,
                                   Multimap<String, String> translateDict) {
    if (dataMediaPair.getColumnPairMode().isExclude() || CollectionUtils.isEmpty(dataMediaPair.getColumnPairs())) {
        return srcColumnName; // 默認同名
    }

    Collection<String> tColumnNames = translateDict.get(srcColumnName);
    if (CollectionUtils.isEmpty(tColumnNames)) {
        throw new TransformException(srcColumnName + " is not found in column pairs: " + translateDict.toString());
    }
    String columnName = tColumnNames.iterator().next();

    return columnName;
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:18,代碼來源:RowDataTransformer.java

示例11: buildWebhookDetails

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/***
 * 構建WebhookDetail信息
 *
 * @param webhooks
 * @param eventParams
 * @param requestParams
 * @return
 */
private List<WebhookDetail> buildWebhookDetails(List<Webhook> webhooks, List<WebhookEventParam> eventParams, List<WebhookRequestParam> requestParams) {
    Multimap<Integer, WebhookEventParam> eventParamMultimap = ArrayListMultimap.create();
    Multimap<Integer, WebhookRequestParam> requestParamMultimap = ArrayListMultimap.create();

    if (CollectionUtils.isNotEmpty(eventParams)) {
        for (WebhookEventParam eventParam : eventParams) {
            eventParamMultimap.put(eventParam.getWebhookId(), eventParam);
        }
    }
    if (CollectionUtils.isNotEmpty(requestParams)) {
        for (WebhookRequestParam requestParam : requestParams) {
            requestParamMultimap.put(requestParam.getWebhookId(), requestParam);
        }
    }

    List<WebhookDetail> webhookDetails = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(webhooks)) {
        for (Webhook webhook : webhooks) {
            Collection<WebhookEventParam> webhookEventParams = eventParamMultimap.get(webhook.getId());
            Collection<WebhookRequestParam> webhookRequestParams = requestParamMultimap.get(webhook.getId());
            WebhookDetail webhookDetail = new WebhookDetail(webhook, webhookEventParams, webhookRequestParams);
            webhookDetails.add(webhookDetail);
        }
    }
    return webhookDetails;
}
 
開發者ID:zouzhirong,項目名稱:configx,代碼行數:35,代碼來源:HookStoreService.java

示例12: replaceModifier

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void replaceModifier(Multimap<String, AttributeModifier> modifierMultimap, IAttribute attribute, UUID id, double multiplier) {

		final Collection<AttributeModifier> modifiers = modifierMultimap.get(attribute.getName());
		final Optional<AttributeModifier> modifierOptional = modifiers.stream().filter(attributeModifier -> attributeModifier.getID().equals(id)).findFirst();

		if (modifierOptional.isPresent()) {
			final AttributeModifier modifier = modifierOptional.get();
			modifiers.remove(modifier);
			modifiers.add(new AttributeModifier(modifier.getID(), modifier.getName(), modifier.getAmount() * multiplier, modifier.getOperation()));
		}
	}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:12,代碼來源:BaseHarshenScythe.java

示例13: getDamage

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public float getDamage()
{
	Multimap<String, AttributeModifier> modifiersMap = this.getRenderStack().getAttributeModifiers(EntityEquipmentSlot.MAINHAND);
	double ret = 1;
	if (modifiersMap.containsKey(SharedMonsterAttributes.ATTACK_DAMAGE.getName()))
	{
		for (AttributeModifier mod : modifiersMap.get(SharedMonsterAttributes.ATTACK_DAMAGE.getName()))
		{
			ret = mod.getOperation() == 0 ? ret + mod.getAmount() : ret * mod.getAmount();
		}
	}
	
	return (float) ret;
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:15,代碼來源:EntityThrownWeapon.java

示例14: checkDepths

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
 * Check the "depth" (number of regions included at a split) of a generated
 * split calculation
 */
void checkDepths(SortedSet<byte[]> splits,
    Multimap<byte[], SimpleRange> regions, Integer... depths) {
  assertEquals(splits.size(), depths.length);
  int i = 0;
  for (byte[] k : splits) {
    Collection<SimpleRange> rs = regions.get(k);
    int sz = rs == null ? 0 : rs.size();
    assertEquals((int) depths[i], sz);
    i++;
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:TestRegionSplitCalculator.java

示例15: dumpOverlapProblems

import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public void dumpOverlapProblems(Multimap<byte[], HbckInfo> regions) {
  // we display this way because the last end key should be displayed as
  // well.
  for (byte[] k : regions.keySet()) {
    errors.print(Bytes.toStringBinary(k) + ":");
    for (HbckInfo r : regions.get(k)) {
      errors.print("[ " + r.toString() + ", "
          + Bytes.toStringBinary(r.getEndKey()) + "]");
    }
    errors.print("----");
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:13,代碼來源:HBaseFsck.java


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