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