public class Bus{
private int seats;
private List<People> currentPeople;
public Bus(int seats){
this.seats = seats;
}
public void passengers(List<People> boarders, List<People> deboarders){
this.currentPeople.remove(deboarders);
this.currentPeople.add(boarders);
}
I'm trying to create a list of people on the bus. I'm trying to remove deboarders(alighting passengers) from the list and add the boarders(boarding passengers). But Java won't let me add the boarders to the currentPeople list. People is a class which stores the name and ticket number of the passanger. Any help on this? I've been trying to solve this for hours.