reactor.util.function.Tuples.fnAny()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(203)

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

Tuples.fnAny介绍

[英]A converting function from Object array to Tuples
[中]从对象数组到元组的转换函数

代码示例

代码示例来源:origin: reactor/reactor-core

/**
 * A converting function from Object array to {@link Tuples} to R.
 *
 * @param <R> The type of the return value.
 * @param delegate the function to delegate to
 *
 * @return The unchecked conversion function to R.
 */
public static <R> Function<Object[], R> fnAny(final Function<Tuple2, R> delegate) {
  return objects -> delegate.apply(Tuples.fnAny().apply(objects));
}

代码示例来源:origin: reactor/reactor-core

@Override
  public Publisher<V> apply(List<? extends Publisher<?>> publishers) {
    return zip(Tuples.fnAny((Function<Tuple2, V>)
        combinator), publishers.toArray(new Publisher[publishers
        .size()]));
  }
}));

代码示例来源:origin: reactor/reactor-core

@Test
@SuppressWarnings("unchecked")
public void fnAny() {
  Integer[] source = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  Tuple2<Object, Object> tuple = Tuples.fnAny().apply(source);
  assertThat(tuple.getT1()).isEqualTo(1);
  assertThat(tuple.getT2()).isEqualTo(2);
  assertThat(tuple)
      .isInstanceOf(Tuple8.class)
      .containsExactly(1, 2, 3, 4, 5, 6, 7, 8);
}

代码示例来源:origin: reactor/reactor-core

@Test
public void fnAnyDelegate() {
  Integer[] source = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 };
  Function<Tuple2, Tuple2<Object, Object>> invert = t2 -> new Tuple2<>(t2.getT2(), t2.getT1());
  Tuple2<Object, Object> tuple = Tuples.fnAny(invert).apply(source);
  assertThat(tuple.getT1()).isEqualTo(2);
  assertThat(tuple.getT2()).isEqualTo(1);
  assertThat(tuple)
      .isExactlyInstanceOf(Tuple2.class)
      .containsExactly(2, 1);
}

代码示例来源:origin: io.projectreactor/reactor-core

/**
 * A converting function from Object array to {@link Tuples} to R.
 *
 * @param <R> The type of the return value.
 * @param delegate the function to delegate to
 *
 * @return The unchecked conversion function to R.
 */
public static <R> Function<Object[], R> fnAny(final Function<Tuple2, R> delegate) {
  return objects -> delegate.apply(Tuples.fnAny().apply(objects));
}

代码示例来源:origin: io.projectreactor/reactor-core

@Override
  public Publisher<V> apply(List<? extends Publisher<?>> publishers) {
    return zip(Tuples.fnAny((Function<Tuple2, V>)
        combinator), publishers.toArray(new Publisher[publishers
        .size()]));
  }
}));

相关文章