I know I need to make Date immutable. However, I am not sure what else needs to be amended to ensure the class is immutable. final has been declared for the class and its methods.
public final class Journal {
private final Set<Article> edition;
private final Date pubDate;
public Journal(Article [] contents, Date d) {
edition = new TreeSet<Article>();
for(int i=0; i <contents.length; i++)
edition.add(contents[i]);
pubDate = d;
}
public Set<Article> getArticles() {
return Collections.unmodifiableSortedSet(edition);
}
public Date getDate() { return pubDate; }
}