random streams (original) (raw)
Brian Goetz brian.goetz at oracle.com
Mon Dec 31 10:41:44 PST 2012
- Previous message: Streams -- philosophy
- Next message: random streams
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On the list of requested stream sources is 'stream of random numbers'.
Here's a one-line addition to Random:
public IntStream ints() {
return PrimitiveStreams.repeatedly(this::nextInt);
}
Certainly the implementation is straightforward enough (modulo renaming of PrimitiveStreams and repeatedly, which are not yet nailed down.)
Any objections here? Clearly we'd want to support streams of ints, longs, and doubles, so just calling it stream() is wrong; should they be called random.ints(), or random.intStream()?
- Previous message: Streams -- philosophy
- Next message: random streams
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-experts mailing list