当前位置: 首页>>代码示例>>Java>>正文


Java Maps.asMap方法代码示例

本文整理汇总了Java中com.google.common.collect.Maps.asMap方法的典型用法代码示例。如果您正苦于以下问题:Java Maps.asMap方法的具体用法?Java Maps.asMap怎么用?Java Maps.asMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Maps的用法示例。


在下文中一共展示了Maps.asMap方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connectionsOf

import com.google.common.collect.Maps; //导入方法依赖的package包/类
private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) {
  if (network.isDirected()) {
    Map<E, N> inEdgeMap = Maps.asMap(network.inEdges(node), sourceNodeFn(network));
    Map<E, N> outEdgeMap = Maps.asMap(network.outEdges(node), targetNodeFn(network));
    int selfLoopCount = network.edgesConnecting(node, node).size();
    return network.allowsParallelEdges()
        ? DirectedMultiNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount)
        : DirectedNetworkConnections.ofImmutable(inEdgeMap, outEdgeMap, selfLoopCount);
  } else {
    Map<E, N> incidentEdgeMap =
        Maps.asMap(network.incidentEdges(node), adjacentNodeFn(network, node));
    return network.allowsParallelEdges()
        ? UndirectedMultiNetworkConnections.ofImmutable(incidentEdgeMap)
        : UndirectedNetworkConnections.ofImmutable(incidentEdgeMap);
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:ImmutableNetwork.java

示例2: edgeIncidentNodesMap

import com.google.common.collect.Maps; //导入方法依赖的package包/类
private static <N, E> Map<E, EndpointPair<N>> edgeIncidentNodesMap(final Network<N, E> network) {
  Function<E, EndpointPair<N>> edgeToIncidentNodesFn =
      new Function<E, EndpointPair<N>>() {
        @Override
        public EndpointPair<N> apply(E edge) {
          return network.incidentNodes(edge);
        }
      };
  return Maps.asMap(network.edges(), edgeToIncidentNodesFn);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:11,代码来源:AbstractNetwork.java

示例3: edgeValueMap

import com.google.common.collect.Maps; //导入方法依赖的package包/类
private static <N, V> Map<EndpointPair<N>, V> edgeValueMap(final ValueGraph<N, V> graph) {
  Function<EndpointPair<N>, V> edgeToValueFn =
      new Function<EndpointPair<N>, V>() {
        @Override
        public V apply(EndpointPair<N> edge) {
          return graph.edgeValue(edge.nodeU(), edge.nodeV());
        }
      };
  return Maps.asMap(graph.edges(), edgeToValueFn);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:11,代码来源:AbstractValueGraph.java

示例4: createWithoutMetadata

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public static ArgumentOutput createWithoutMetadata(final Symbol docId,
    final Iterable<Scored<Response>> scoredResponses) {
  final Map<Response, String> emptyMetadata = Maps.asMap(FluentIterable.from(scoredResponses)
      .transform(Scoreds.<Response>itemsOnly()).toSet(), Functions.constant(DEFAULT_METADATA));
  return from(docId, scoredResponses, emptyMetadata);
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:7,代码来源:ArgumentOutput.java

示例5: columnMap

import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public Map<C, Map<R, V>> columnMap() {
    return Maps.asMap(columnKeySet(), this::column);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:TableView.java

示例6: column

import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public Map<R, V> column(C columnKey) {
    return Maps.asMap(Sets.filter(rowKeySet(), rowKey -> contains(rowKey, columnKey)),
                      rowKey -> map.get(rowKey).get(columnKey));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:TableView.java

示例7: getZeroPayment

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public static <T extends Good> Payment<T> getZeroPayment(Set<Bidder<T>> bidders) {
    BidderPayment zeroBidderPayment = new BidderPayment(0);
    Function<Object, BidderPayment> zeroPaymentFunction = Functions.constant(zeroBidderPayment);
    Map<Bidder<T>, BidderPayment> emptyPaymentMap = Maps.asMap(bidders, zeroPaymentFunction);
    return new Payment<T>(emptyPaymentMap);
}
 
开发者ID:spectrumauctions,项目名称:sats-opt,代码行数:7,代码来源:Payment.java


注:本文中的com.google.common.collect.Maps.asMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。