Specific array type from UML?

Viewed 170

I was wondering if this UML specifies that it HAS to be an ordinary array in the constructor of the Lesson class. I'm wondering because it doesn't include any size, and it has a relationship with another class from 0..*.

Not sure if I'm reading the UML correctly if I decide to make it an ArrayList - or would that be allowed?

UML Screenshot here

1 Answers

UML doesn't mandate anything about how the relationship is implemented when it comes to concrete code. It just specifies that a lesson has 0 to many associated Files (with a steer that the relationship is named resources).

As such, you can use any kind of collection (UML doesn't tell you if there is any ordering so it could be an Array, List, Set etc, whatever makes sense to your program.

The fact it is 0..* additionally means that no files is a valid state and so you can choose whether to populate the collection in a constructor or to construct it empty then add resources.

Related