示例#1
0
  @Test
  public void shouldZipTwoInfiniteSequences() throws Exception {
    // given
    final LazySeq<Integer> naturals = numbers(1);
    final LazySeq<Integer> primes = primes();

    // when
    final LazySeq<String> zipped = naturals.zip(primes, (n, p) -> n + ": " + p);

    // then
    assertThat(zipped.take(5)).isEqualTo(of("1: 2", "2: 3", "3: 5", "4: 7", "5: 11"));
  }