org.apache.edgent.function.Functions.zero()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.apache.edgent.function.Functions.zero()方法的一些代码示例,展示了Functions.zero()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.zero()方法的具体详情如下:
包路径:org.apache.edgent.function.Functions
类名称:Functions
方法名:zero

Functions.zero介绍

[英]Returns a constant function that returns zero (0).
[中]返回一个返回零(0)的常量函数。

代码示例

代码示例来源:origin: org.apache.edgent/edgent-api-function

/**
 * Returns a constant function that returns zero (0).
 * This is identical to {@link #zero()} but is more
 * readable when applied as a key function.
 * @param <T> tuple type
 * @return Constant function that returns zero (0).
 */
public static <T> Function<T,Integer> unpartitioned() {
  return zero();
}

代码示例来源:origin: apache/incubator-edgent

/**
 * Returns a constant function that returns zero (0).
 * This is identical to {@link #zero()} but is more
 * readable when applied as a key function.
 * @param <T> tuple type
 * @return Constant function that returns zero (0).
 */
public static <T> Function<T,Integer> unpartitioned() {
  return zero();
}

代码示例来源:origin: apache/incubator-edgent

@Test
public void testZero() {
  String s = "hello";
  assertEquals(Integer.valueOf(0), zero().apply(s));
  
  Integer i = 42;
  assertEquals(Integer.valueOf(0), zero().apply(i));
  
  Object o = new Object();
  assertEquals(Integer.valueOf(0), zero().apply(o));
}
@Test

代码示例来源:origin: apache/incubator-edgent

assertSame(zero(), window.getKeyFunction());
TStream<Long> diffStream = window.aggregate((tuples, key) -> {
  assertEquals(Integer.valueOf(0), key);

相关文章