Search code examples
hashmapumlclass-diagram

Hashmap in UML diagram?


I want to write a class diagram for a class that contains a hashmap. Normally, I would do this:

enter image description here

But my Map looks like this:

private Map<Beacon, String> beaconRoute;

The key is a custom class.

How can I describe it in an UML diagram?


Solution

  • Use beacon : Beacon inside the qualifier rectangle and use the String data type as the target type (instead of Employee). The property beaconRoute is the association end name. You don't have to be so literal as to have a Map class in UML--doing that loses sight of the problem domain. Not that I understand why a Beacon would map to a String, though. Did you reverse the key and value by mistake?