Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

List, ArrayList and Generics as UML

 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Matt, I think you are right. It probably should be moved someplace else ; - )

Regards,
Dan
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have moved this topic to a more suitable forum.
 
Bartender
Posts: 1205
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic