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


Java Multimaps.transformValues方法代碼示例

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


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

示例1: computeToString

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private String computeToString() {
  StringBuilder builder = new StringBuilder().append(type).append('/').append(subtype);
  if (!parameters.isEmpty()) {
    builder.append("; ");
    Multimap<String, String> quotedParameters =
        Multimaps.transformValues(
            parameters,
            new Function<String, String>() {
              @Override
              public String apply(String value) {
                return TOKEN_MATCHER.matchesAllOf(value) ? value : escapeAndQuote(value);
              }
            });
    PARAMETER_JOINER.appendTo(builder, quotedParameters.entries());
  }
  return builder.toString();
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:18,代碼來源:MediaType.java

示例2: getTasksByHosts

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private Multimap<String, String> getTasksByHosts(StoreProvider provider, Iterable<String> hosts) {
  if (Iterables.isEmpty(hosts)) {
    return ImmutableMultimap.of();
  }

  ImmutableSet.Builder<IScheduledTask> drainingTasks = ImmutableSet.builder();
  drainingTasks.addAll(provider.getTaskStore()
      .fetchTasks(Query.slaveScoped(hosts).byStatus(Tasks.SLAVE_ASSIGNED_STATES)));
  return Multimaps.transformValues(
      Multimaps.index(drainingTasks.build(), Tasks::scheduledToSlaveHost),
      Tasks::id);
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:13,代碼來源:Maintenance.java

示例3: assertState

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private void assertState(
    JobUpdateStatus expected,
    Multimap<Integer, JobUpdateAction> expectedActions) {

  IJobUpdateDetails details = getDetails();
  Iterable<IJobInstanceUpdateEvent> orderedEvents =
      EVENT_ORDER.sortedCopy(details.getInstanceEvents());
  Multimap<Integer, IJobInstanceUpdateEvent> eventsByInstance =
      Multimaps.index(orderedEvents, EVENT_TO_INSTANCE);
  Multimap<Integer, JobUpdateAction> actionsByInstance =
      Multimaps.transformValues(eventsByInstance, JobUpdateControllerImpl.EVENT_TO_ACTION);
  assertEquals(expectedActions, actionsByInstance);
  assertEquals(expected, details.getUpdate().getSummary().getState().getStatus());
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:15,代碼來源:JobUpdaterIT.java

示例4: computeToString

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private String computeToString() {
  StringBuilder builder = new StringBuilder().append(type).append('/').append(subtype);
  if (!parameters.isEmpty()) {
    builder.append("; ");
    Multimap<String, String> quotedParameters = Multimaps.transformValues(parameters, new Function<String, String>() {
                                                                                        @Override
                                                                                        public String apply(String value) {
                                                                                          return TOKEN_MATCHER.matchesAllOf(value) ? value : escapeAndQuote(value);
                                                                                        }
                                                                                      });
    PARAMETER_JOINER.appendTo(builder, quotedParameters.entries());
  }
  return builder.toString();
}
 
開發者ID:antlr,項目名稱:codebuff,代碼行數:15,代碼來源:MediaType.java

示例5: apply

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
@Override
public TestHistoryDifferenceDescription apply(@Nonnull AbstractHistoryDifference<?, ?> input) {
	return new TestHistoryDifferenceDescription(
			input.getEventType(),
			Multimaps.transformValues(
					Multimaps.index(input.getDifferences(), HISTORY_DIFFERENCE_TO_DIFFERENCE_KEY),
					HISTORY_DIFFERENCE_TO_DESCRIPTION // Recursion. On suppose qu'il n'y a pas de cycle.
			)
	);
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:11,代碼來源:TestHistoryDifferenceCollectionMatcher.java

示例6: toString

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
/**
 * Returns the string representation of this media type in the format described in <a
 * href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>.
 */
@Override public String toString() {
  StringBuilder builder = new StringBuilder().append(type).append('/').append(subtype);
  if (!parameters.isEmpty()) {
    builder.append("; ");
    Multimap<String, String> quotedParameters = Multimaps.transformValues(parameters,
        new Function<String, String>() {
          @Override public String apply(String value) {
            return TOKEN_MATCHER.matchesAllOf(value) ? value : escapeAndQuote(value);
          }
        });
    PARAMETER_JOINER.appendTo(builder, quotedParameters.entries());
  }
  return builder.toString();
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:19,代碼來源:MediaType.java

示例7: outputSymbolMap

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
/**
 * Returns the input to output symbol mapping for the given source channel.
 * A single input symbol can map to multiple output symbols, thus requiring a Multimap.
 */
public Multimap<Symbol, QualifiedNameReference> outputSymbolMap(int sourceIndex)
{
    return Multimaps.transformValues(FluentIterable.from(getOutputSymbols())
            .toMap(outputToSourceSymbolFunction(sourceIndex))
            .asMultimap()
            .inverse(), Symbol::toQualifiedNameReference);
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:12,代碼來源:UnionNode.java

示例8: computeToString

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private String computeToString() {
    StringBuilder builder = new StringBuilder().append(type).append('/').append(subtype);
    if (!parameters.isEmpty()) {
        builder.append("; ");
        Multimap<String, String> quotedParameters =
                Multimaps.transformValues(
                        parameters,
                        value -> TOKEN_MATCHER.matchesAllOf(value) ? value : escapeAndQuote(value));
        PARAMETER_JOINER.appendTo(builder, quotedParameters.entries());
    }
    return builder.toString();
}
 
開發者ID:line,項目名稱:armeria,代碼行數:13,代碼來源:MediaType.java

示例9: getVictims

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private Multimap<String, PreemptionVictim> getVictims(IScheduledTask... tasks) {
  return Multimaps.transformValues(
      Multimaps.index(Arrays.asList(tasks), task -> task.getAssignedTask().getSlaveId()),
      task -> PreemptionVictim.fromTask(task.getAssignedTask())
  );
}
 
開發者ID:PacktPublishing,項目名稱:Mastering-Mesos,代碼行數:7,代碼來源:PendingTaskProcessorTest.java

示例10: description

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private Multimap<TestHistoryDifferenceKey, TestHistoryDifferenceDescription> description(Collection<D> collection) {
	return Multimaps.transformValues(
			Multimaps.index(collection, HISTORY_DIFFERENCE_TO_DIFFERENCE_KEY),
			HISTORY_DIFFERENCE_TO_DESCRIPTION
	);
}
 
開發者ID:openwide-java,項目名稱:owsi-core-parent,代碼行數:7,代碼來源:TestHistoryDifferenceCollectionMatcher.java

示例11: transformRefs

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private static ListMultimap<ObjectId, PatchSet.Id> transformRefs(
    ListMultimap<ObjectId, Ref> refs) {
  return Multimaps.transformValues(refs, r -> PatchSet.Id.fromRef(r.getName()));
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:5,代碼來源:GroupCollector.java

示例12: convertCurrentPojoLinksToPseudoLines

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
private Multimap<String, String> convertCurrentPojoLinksToPseudoLines(
        Multimap<String, PojoData> requestedPojosByName,
        Map<Long, Collection<TagAnnotationData>> databasePojosTagsLinks,
        Collection<PojoData> experimenterPojos) throws ServerError {

    Check.notEmpty(requestedPojosByName.asMap(), "requestedPojosByName");
    Check.notEmpty(experimenterPojos, "experimenterPojos");

    // transform the tags-pojos pairs coming from the database into "lines"
    // for comparison with the csv file
    // ie. switch from the map of already linked datasets/images-tags with:
    // key=pojo_id and values=[tags]
    // to a multimap of character strings with:
    // key=tag and values=[pojo_names]:
    // <Long>, [TagAnnotationData] -> <String>, [TagAnnotationData] -> <String>, [String] -> invert
    log.trace("requestedPojosByName: {}",
               requestedPojosByName.size(), requestedPojosByName);

    // convert the query result to a multimap for convenient manipulation
    Multimap<Long, TagAnnotationData> dbPojoTagsMultimap = fromTagsMap(databasePojosTagsLinks);

    // keep their name only: key=pojo_id, values=[attached_tag_names]
    Multimap<Long, String> dbPojoIdToTagNames =
        Multimaps.transformValues(dbPojoTagsMultimap, FunctionsUtil.toTagValue);

    // then, convert to name-names multimap: key=pojo_name, values=[attached_tag_names]
    Multimap<String, String> dbPojoNameToTagNames = HashMultimap.create();
    Map<Long, PojoData> availablePojosById = indexById(experimenterPojos);

    for (Long pojoId : dbPojoIdToTagNames.keySet()) {
        Collection<String> unchangedTagNames = dbPojoIdToTagNames.get(pojoId);

        if (availablePojosById.containsKey(pojoId)) {
            PojoData pojo = availablePojosById.get(pojoId);
            String pojoName = pojo.getName();

            dbPojoNameToTagNames.putAll(pojoName, unchangedTagNames);
        } else {
            log.error("ERROR - Unable to map pojo id {} to name - inconsistent state", pojoId);
        }
    }

    log.debug("dbPojoNameToTagNames: {} - {}",
               dbPojoNameToTagNames.size(), dbPojoNameToTagNames);

    // provide the inverse mapping again to make sure both maps are comparable
    Multimap<String, String> dbTagNameToPojosNames = invertKeyValues(dbPojoNameToTagNames);

    log.debug("dbTagNameToPojosNames: {} - {}",
              dbTagNameToPojosNames.size(), dbTagNameToPojosNames);

    return dbTagNameToPojosNames;
}
 
開發者ID:imagopole,項目名稱:omero-csv-tools,代碼行數:54,代碼來源:DefaultCsvAnnotationService.java

示例13: getConfiguredTargetMap

import com.google.common.collect.Multimaps; //導入方法依賴的package包/類
/**
 * Returns an immutable map from attribute name to list of configured targets for that attribute.
 */
public ListMultimap<String, ? extends TransitiveInfoCollection> getConfiguredTargetMap() {
  return Multimaps.transformValues(targetMap, ConfiguredTargetAndTarget::getConfiguredTarget);
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:7,代碼來源:RuleContext.java


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