Iterable.* extension methods, for example
map(), create a new
ArrayList and place the output there. This of course introduces the overhead of creating a new
ArrayList every time I call one of those methods, which may get ugly when multiple methods are chained together.
I learned that there in fact is in-place filter operation - the
MutableIterable.retainAll() and its counterpart
MutableIterable.removeAll(), which is great. Unfortunately there is no
mapInPlace could be implemented not on top of
MutableIterable, but rather on top of
ListIterator. While technically possible, it seems just weird having
*inPlace() counterparts of all
Iterable.* methods… So, perhaps would you consider implementing only a subset of those methods, like
mapInPlace and perhaps a couple of others?
Many thanks, and I apologize if this question has been already answered elsewhere.