aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes List, ArrayList and Generics as UML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "List, ArrayList and Generics as UML" Watch "List, ArrayList and Generics as UML" New topic
Author

List, ArrayList and Generics as UML

Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
Good Day,

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

How do you think it should look like?

Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
matt love
Ranch Hand

Joined: Jan 25, 2010
Posts: 67
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

Joined: Jul 09, 2001
Posts: 1180
Hi Matt, I think you are right. It probably should be moved someplace else ; - )

Regards,
Dan
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

I have moved this topic to a more suitable forum.


Mohamed Sanaulla | My Blog
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1012
    
    3
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:


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: List, ArrayList and Generics as UML