I need a collection that behaves something like C++ multimap, but I also need to be able to get elements by a range of keys.
There is no built-in multimap collection in Java. To solve this you can map to every key a list of values: Map<String, List<String>>
, for example. Otherwise there are third-party libraries with implemented multimaps - here is one of them.