skip, limit and slice (original) (raw)
Brian Goetz brian.goetz at oracle.com
Wed Dec 5 07:06:22 PST 2012
- Previous message: skip, limit and slice
- Next message: Stream.toArray()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Correct. If you look at the implementation:
@Override
public Stream<U> limit(long limit) {
return pipeline(new SliceOp<U>(0, limit));
}
@Override
public Stream<U> skip(long toSkip) {
return pipeline(new SliceOp<U>(toSkip));
}
@Override
public Stream<U> slice(long skip, long limit) {
return pipeline(new SliceOp<U>(skip, limit));
}
they are strictly for convenience.
On 12/5/2012 9:38 AM, Remi Forax wrote:
skip and limit can be written using slice(), limit(n) => slice(0, n) skip(n) => slice(n, Long.MAXVALUE)
so there are not strictly needed. Given that limit() is a known idiom, may be only limit() and skip() should be kept with the default implementation of limit() calling slice(0, limit). cheers, Rémi
- Previous message: skip, limit and slice
- Next message: Stream.toArray()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-experts mailing list