2

There's a following example in Vavr documentation:

// 1000 random numbers
for (double random : Stream.gen(Math::random).take(1000)) {
    ...
}

However, I cannot find the above method (gen) on Stream type in vavr javadoc.

These seem to be similar behariors:

        for (double nonRandom : Stream.range(1, 20)) {
            System.out.println(nonRandom);
        }

        for (double random : Stream.continually(Math::random).take(7)) {
            System.out.println(random);
        }

but is there a Stream.gen() somewhere as well?

Am I searching in the wrong places or is it an out-of-date method mentioned in the vavr user guide?

Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82

1 Answers1

2

Yes, vavr documentation is outdated in that regard, as that method got renamed to Stream.continually(...) in pull request 1148 to align with the Scala API.

Nándor Előd Fekete
  • 6,988
  • 1
  • 22
  • 47
  • 2
    See also [issue 37](https://github.com/vavr-io/vavr-docs/issues/37) where you can track this documentation issue. – Nándor Előd Fekete Feb 05 '18 at 21:51
  • 1
    Ah, perfect. Thanks for the quick fix. See this for another improvement that could be made to the current usage doc: https://stackoverflow.com/questions/48629111/vavr-property-testing – Simeon Leyzerzon Feb 05 '18 at 22:26