當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。