Marian Marian - 2 months ago 8
Java Question

How create constructor with Set field and parametrs TreeSet

public class Schedule {

private Set<Seance> schedule;

public Schedule(){}

public Schedule(??) {
super();
// ??
}
}


I need some this:
private Set<> schedule = new TreeSet<>();
but i need do this in constructor, because i want use Schedule object by sort object Seance/// and this object Schedule I want add to MAP... help please. And sorry for my english)

Pat Pat
Answer

Try this !!

public Schedule(){
schedule = new TreeSet<Seance>();
}

public Schedule(Set<Seance> schedule) {
    super();
   this.schedule = schedule;
}
Comments