-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explore consequences of adding ImgLibStream wrapper #339
Comments
Originally posted by @ctrueden in #336 (comment)
We would still have to override all I started doing it have something concrete to discuss: static class ImgLibStream<T extends Type<T>> implements Stream<T> {
private final Stream<T> delegate;
ImgLibStream(Stream<T> delegate) {
this.delegate = delegate;
}
@Override
public ImgLibStream<T> filter(final Predicate<? super T> predicate) {
return new ImgLibStream<>(delegate.filter(predicate));
}
@Override
public <R> Stream<R> map(final Function<? super T, ? extends R> mapper) {
return delegate.map(mapper);
}
....
}
Besides Streams.localizing(myImg).foreach((pos, t) -> t.set(pos.x() + pos.y())); |
Does it make sense to add
ImgLibStream
wrapper aroundjava.util.stream.Stream
?With this we could augment
Stream
with additional operations. For example:.materialize()
could be a shortcut for.map(Type::copy)
..distinct()
and.sort()
to make sure that copies have been made before, etc.However, wrapping all
Stream
methods, will add quite a lot of code, it's not clear whether it can be completely wrapped without leaky abstractions, etc. Just try it to see what the trade-offs are...The text was updated successfully, but these errors were encountered: