I've got following array:
private static Optreden[] optredens = {
new Optreden("Editors", "Main Stage", 16, 0, 4),
new Optreden("Empire of the Sun", "Pyramid Marquee", 23, 45, 5),
new Optreden("Florence and the Machine", "Marquee", 18, 45, 3),
new Optreden("The Specials", "Marquee", 13, 10, 5),
new Optreden("Muse", "Main Stage", 19, 0, 5),
new Optreden("Faithless", "Main Stage", 14, 30, 5),
new Optreden("Absynthe Minded", "Pyramid Marquee", 21, 45, 5),
new Optreden("Pink", "Main Stage", 20, 30, 2),
new Optreden("Editors", "Marquee", 21, 20, 4),
new Optreden("Faithless", "Pyramid Marquee", 19, 0, 5)
};
The Optreden object constructor looks like this:
Optreden(name, stage, hour, minutes, rating);
Now, I have to create a HashSet of the Optreden objects BUT it may not contain duplicate names, so when I print the HashSet it has to look like this:
The Specials (Marquee, 13u10)--> *****
Empire of the Sun (Pyramid Marquee, 23u45)--> *****
Florence and the Machine (Marquee, 18u45)--> ***
Pink (Main Stage, 20u30)--> **
Muse (Main Stage, 19u)--> *****
Absynthe Minded (Pyramid Marquee, 21u45)--> *****
Editors (Main Stage, 16u)--> ****
Faithless (Main Stage, 14u30)--> *****
Thing is, I can't edit the Optreden class and it only has a constructor and a toString method, no getName() getter.
How can I pull this off? Thanks.