TrainOrdersModel[] ordersArray = new TrainOrdersModel[orders.size()];  for (int i = 0; i < ordersArray.length; i++) { ordersArray[i] = (TrainOrdersModel)orders.get(i); }  return new ImmutableSchedule(ordersArray, this.nextScheduledOrder, this.hasPriorityOrders);
return new ImmutableSchedule((TrainOrdersModel[]) orders.toArray(new TrainOrdersModel[orders.size()]));
    public ImmutableSchedule toImmutableSchedule() {        TrainOrdersModel[] ordersArray = new TrainOrdersModel[orders.size()];        for (int i = 0; i < ordersArray.length; i++) {            ordersArray[i] = (TrainOrdersModel)orders.get(i);        }        return new ImmutableSchedule(ordersArray, this.nextScheduledOrder,            this.hasPriorityOrders);    }