cyclops.reactive.ReactiveSeq.zipWithStream()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(103)

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

ReactiveSeq.zipWithStream介绍

暂无

代码示例

代码示例来源:origin: aol/cyclops

@Override
default <U, R> ReactiveSeq<R> zip(final BiFunction<? super T, ? super U, ? extends R> zipper, final Publisher<? extends U> other) {
  return zipWithStream(ReactiveSeq.fromPublisher(other), zipper);
}

代码示例来源:origin: aol/cyclops

@Override
default <U, R> ReactiveSeq<R> zip(final Iterable<? extends U> other, final BiFunction<? super T, ? super U, ? extends R> zipper) {
  return (ReactiveSeq<R>) zipWithStream(ReactiveSeq.fromIterable(other),zipper);
}

代码示例来源:origin: aol/cyclops

@Override
default <U> ImmutableSortedSet<Tuple2<T, U>> zipWithStream(Stream<? extends U> other) {
  return unitStream(stream().zipWithStream(other));
}

代码示例来源:origin: aol/cyclops

@Override
default <U, R> ImmutableSortedSet<R> zipWithStream(Stream<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) {
  return unitStream(stream().zipWithStream(other,zipper));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimFirstFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C","D");
  final ReactiveSeq<Integer> second = of(1, 2, 3);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),equalTo(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimSecondFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C");
  final ReactiveSeq<Integer> second = of(1, 2, 3, 4);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),is(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimSecondFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C");
  final ReactiveSeq<Integer> second = of(1, 2, 3, 4);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),is(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimSecondFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C");
  final ReactiveSeq<Integer> second = of(1, 2, 3, 4);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),is(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimFirstFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C","D");
  final ReactiveSeq<Integer> second = of(1, 2, 3);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),equalTo(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimFirstFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C","D");
  final ReactiveSeq<Integer> second = of(1, 2, 3);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),equalTo(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimFirstFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C","D");
  final ReactiveSeq<Integer> second = of(1, 2, 3);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),equalTo(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimSecondFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C");
  final ReactiveSeq<Integer> second = of(1, 2, 3, 4);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),is(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimSecondFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C");
  final ReactiveSeq<Integer> second = of(1, 2, 3, 4);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),is(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimFirstFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C","D");
  final ReactiveSeq<Integer> second = of(1, 2, 3);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.collect(Collectors.toList()).size(),equalTo(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimSecondFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C");
  final ReactiveSeq<Integer> second = of(1, 2, 3, 4);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.to(Streamable::fromStream).collect(Collectors.toList()).size(),is(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void asyncZip(){
  System.out.println(Thread.currentThread().getId());
  assertThat(Spouts.of(1,2,3,4,5)
      .zipWithStream(nextAsync())
      .grouped(2)
      .flatMap(i->i.stream())
      .toList(),equalTo(Arrays.asList(Tuple.tuple(1,1),Tuple.tuple(2,2))));
}
private ReactiveSeq<Integer> nextAsync() {

代码示例来源:origin: aol/cyclops

@Test
public void shouldTrimFirstFixedSeqIfLongerStream() throws Exception {
  final ReactiveSeq<String> first = of("A", "B", "C","D");
  final ReactiveSeq<Integer> second = of(1, 2, 3);
  final ReactiveSeq<String> zipped = first.zipWithStream(second, (a, b) -> a + b);
  assertThat(zipped.to(Streamable::fromStream).collect(Collectors.toList()).size(),equalTo(3));
}

代码示例来源:origin: aol/cyclops

@Test
public void zip2() {
  assertThat(of(1, 2).zipWithStream(of('a', 'b')).toList(), equalTo(Arrays.asList(tuple(1, 'a'), tuple(2, 'b'))));
}

代码示例来源:origin: aol/cyclops

@Test @Ignore
public void limitLast(){
  AsyncSubscriber<String> pushable = Spouts.asyncSubscriber();
  ReactiveSeq<String> stream = pushable.stream();
  pushable.onNext("hello1");
  pushable.onNext("hello2");
  pushable.onNext("hello3");
  pushable.onComplete();
  // stream.printOut();
  stream.takeRight(2).zipWithStream(Stream.of(1,2)).printOut();
}

代码示例来源:origin: aol/cyclops

@Test
public void rangeLong(){
  ReactiveSeq.rangeLong(0,5).reverse().reverse().reverse().printOut();
  of('a').zipWithStream(ReactiveSeq.rangeLong(0,100)).printOut();
}
@Test

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法