bluej - Java Incompatible Types Error Arraylists -
i'm using bluej ide , whenever try compile java code gives me error: incompatible types
highlighting brackets of:
s.getcourtsportarraylist()
why happening?
public void showcourtbookings() { for(sport s : sportlist) { for(court c : s.getcourtsportarraylist() ) { system.out.println("court: " + c.getcourt); int i; i=1; for(booking b : c.getbookings()) { system.out.println("booking: " + + "start time: " + b.gettimestart() + "end time :" + b.getendtime()); = + 1; } } } }
this class club
, contains 2 arraylists;
private arraylist<member> memberlist; private arraylist<sport> sportlist;
the sport
class has following arraylist:
private arraylist<court> courtlist = new arraylist<court>();
the court
class has these arraylists:
private arraylist<booking> listbooking;
hopefully can point me in right direction. thanks!
edit: code,
public arraylist getcourtsportarraylist() { return courtlist; }
the getcourtsportarraylist()
seems method of sport class. method needs return list<court>
apparently not right now.
in result method should this:
public list<court> getcourtsportarraylist() { return courtlist; }
side note: should specify generic type list<court>
instead of arraylist<court>
unless use specific implementation details of arraylist.