eclipse-collections
eclipse-collections copied to clipboard
Optimize withAll on MutableIntStackFactoryImpl and ImmutableIntStackFactoryImpl
The code currently in withAll on both mutable and immutable implementations calls toArray on IntStream which if the Stream is very large can be extremely expensive.
Current mutable factory code:
public MutableIntStack withAll(IntStream items)
{
return this.with(items.toArray());
}
Current immutable factory code:
public ImmutableIntStack withAll(IntStream items)
{
return this.with(items.toArray());
}
It would be much better to simply iterate over the Stream and push the results to a IntArrayStack.
I've created this issue as a counterpart to #1372. @nikhilnanivadekar @donraab if you gentlemen agree this is worth pursuing, I could solve it in a similar manner.
Sounds reasonable to me. I've assigned the issue to you. We can review the code when you submit a PR. Thanks!
Hi @donraab can i contribute to this, if no one is working on this
@donraab If @aditya-32 wants to take this over I'm OK with it, please reassign issue to them.