Hashmap in UML diagram?

3.4k views Asked by At

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?

2

There are 2 answers

1
Jim L. On BEST ANSWER

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?

1
qwerty_so On

You can use an association class for that:

enter image description here