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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.