cactoos
cactoos copied to clipboard
CollectionEnvelope<T>, ListEnvelope<T>, etc. should support the Stream<T> in ctor
What do you think about adding a separate constructor to CollectionEnvelope<T>, ListEnvelope<T> which allows to pass Stream<T> instead of collection?
It allows to have lazy initialization without scalar+sticky.
@dgroup could you show an example of what you mean by "It allows to have lazy initialization without scalar+sticky."?
There are two different points we have to clarify:
- since Stream is quite similar to Iterator, maybe it would be best to only add it to IteratorOf and then use IteratorOf passed to other classes
- we won't modify the envelopes for this (because it goes counter to what envelopes are for), but it's not a problem since the same should be achievable by a wrapped class instead, that's why I would like to see an example to be sure I clearly understand the need :)