• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List, ArrayList and Generics as UML

 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day,

I'm trying to draw the following in a UML class diagram.

How do you think it should look like?

Regards,
Dan

 
matt love
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan.

Thanks for answering my question on operators.

Do you have this topic in the right category?

Thanks again.

Matt

 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matt, I think you are right. It probably should be moved someplace else ; - )

Regards,
Dan
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have moved this topic to a more suitable forum.
 
Ryan McGuire
Ranch Hand
Posts: 1057
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic