当前位置: 首页>>代码示例>>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;未经允许,请勿转载。