本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例5: columnMap
import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public Map<C, Map<R, V>> columnMap() {
return Maps.asMap(columnKeySet(), this::column);
}
示例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));
}
示例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);
}