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


Java Functions.constant方法代码示例

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


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

示例1: connectionsOf

import com.google.common.base.Functions; //导入方法依赖的package包/类
private static <N> GraphConnections<N, Presence> connectionsOf(Graph<N> graph, N node) {
  Function<Object, Presence> edgeValueFn = Functions.constant(Presence.EDGE_EXISTS);
  return graph.isDirected()
      ? DirectedGraphConnections.ofImmutable(
          graph.predecessors(node), Maps.asMap(graph.successors(node), edgeValueFn))
      : UndirectedGraphConnections.ofImmutable(
          Maps.asMap(graph.adjacentNodes(node), edgeValueFn));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:ImmutableGraph.java

示例2: DaemonIdleTimeoutExpirationStrategy

import com.google.common.base.Functions; //导入方法依赖的package包/类
public DaemonIdleTimeoutExpirationStrategy(Daemon daemon, int idleTimeout, TimeUnit timeUnit) {
    this(daemon, Functions.constant(timeUnit.toMillis(idleTimeout)));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:DaemonIdleTimeoutExpirationStrategy.java

示例3: good

import com.google.common.base.Functions; //导入方法依赖的package包/类
public static Object good(AnInterface s) {
  return Functions.constant(s);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:4,代码来源:ClassSanityTesterTest.java

示例4: getZeroPayment

import com.google.common.base.Functions; //导入方法依赖的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

示例5: constant

import com.google.common.base.Functions; //导入方法依赖的package包/类
private static <T> Function<T, Object> constant(Object value) {
    //noinspection unchecked
    return (Function<T, Object>) Functions.constant(value);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:SymbolToFieldExtractor.java

示例6: MySpringLayout

import com.google.common.base.Functions; //导入方法依赖的package包/类
/**
 * Constructor for a SpringLayout for a raw graph with associated
 * dimension--the input knows how big the graph is. Defaults to the unit
 * length function.
 * @param g the graph on which the layout algorithm is to operate
 */
@SuppressWarnings("unchecked")
public MySpringLayout(Graph<V,E> g) {
    this(g, (Function<E,Integer>) Functions.<Integer>constant(30));
}
 
开发者ID:jmueller95,项目名称:CORNETTO,代码行数:11,代码来源:MySpringLayout.java


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