JDK-4189329 : Add a MultiMap interface
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1998-11-12
  • Updated: 2021-03-03
  • Resolved: 2000-03-16
Related Reports
Duplicate :  
Description

Name: jb33418			Date: 11/11/98


The HashMap class should allow duplicate keys.

A get operation on a duplicate key would return
an enumeration of all the values associated with
this key.
(Review ID: 42558)
======================================================================

Comments
EVALUATION HashMap itself will never allow duplicate keys, as this would violate the Map interface. It is straightforward to emulate a multimap atop a Map. See the permutation group example in http://www.java.sun.com/docs/books/tutorial/collections/interfaces/map.html . We chose not to add a MultiMap interface to the collections framework initially, because we wanted to keep the framework small, and multimaps are not used all that frequently. The presence of the RFE in our bug database will allow us to keep track of customer demand for this feature. joshua.bloch@Eng 1998-11-11
11-11-1998