3 ms·
Depending on how flexible should it be, it can just very well be a temporary class storing the from and to value and returning it and the final ‘do’ having a co
by kaba0 5y ago
Depending on how flexible should it be, it can just very well be a temporary class storing the from and to value and returning it and the final ‘do’ having a completely normal for loop inside iterating from from to to. This seems to have at most a (in Java very cheap) single plus allocation (static lambdas compile to static methods so not even that allocates in itself).
So I don’t see why would this base case have any significant overhead. Of course a complete stream api will have some.