Open
Description
I name the issue vaguely as I don't want to force any particular change. I will describe my use case and then one possible solution.
Currently MapSplitter
has only one method:
Map<String, String> split(CharSequence sequence)
and returns immutable collection.
My use case is that I would like to change the resulting collection, e.g. by appending some default values for missing entries. I also want to reduce GC pressure and not create unnecessary collections along the way.
One solution that comes to mind is to provide the map to be used for storing the result:
void splitInto(CharSequence sequence, Map<String, String> target)
Instead of map it can be a factory argument:
void splitInto(CharSequence sequence, Supplier<Map<String, String>> mapSupplier)
Additionally both approaches would allow for hash map pooling if required. I can work on a PR if this API addition makes sense.
Activity