First of all,
has two generic parameters, not one. The access is done via the keys, so you need a type for a key and a type for a value. The key should be unique. What is it? Say, the full title of the song, then a string. If not, it could be a combination of the title, the year of first release and the names of the authors. In this case, you need a class or a structure of the keys. Also, you need to override the equivalence/identity methods in the key type with its
; the hash code override is actually formally required if you override
and is actually used by key/value associated containers.
One minor problem is redundant
(file name in your interpretation). This is just a design bug (please see: http://en.wikipedia.org/wiki/Don%27t_repeat_yourself
]). In this way, it's possible to create instances contradicting to each other. Never do such things. Say, introduce a full-path
; but you can also have properties for file name and directory, but returning values on the fly based on full name and the use of