Dan Drillich wrote:Good Day,
I'm trying to draw the following in a UML class diagram.
How do you think it should look like?
Regards,
Dan
Take a look a the third diagram (Figure 6-20) on
this page.
I think your nested generic would have to be notated in two pieces:
The question is could you do that without having to come up with a name for the intermediate Map<
String,String> class?
Then again, Figure 6-19 on that page shows the generic type just written out as the class name. That seems to imply that you could use List<Map<String,String>> as the name of the class without having to use the parameterized class notation or defining a new class (such as EmployeeSet in Fig 6-20).
EDIT: Of course it might help if I actually responded to your question. :-)
I'd show the super/sub-class relation between List<> and ArrayList<>, both as parameterized classes, and then show another class (perhaps anonymous) as a bound element of ArrayList<> with the template parameter bound to Map<String,String>.
Then DATA_SET is an instance of class StringStringMapArrayList.
That combines the two notations given in the page I mentioned earlier. It uses the simple C++, as that page calls it, notation for Map<String,String>but then uses the more verbose parameterized class notation to show the relations between the List and ArrayList generics.
EDIT2:
Oops... I forgot List is "just" an interface. That modifies class diagram just a touch: