private void writeDepartures(final Map<Id<Departure>, Departure> departures) throws IOException, UncheckedIOException {
this.writeStartTag(Constants.DEPARTURES, null);
List<Tuple<String, String>> attributes = new ArrayList<>(3);
for (Departure dep : departures.values()) {
attributes.clear();
attributes.add(createTuple(Constants.ID, dep.getId().toString()));
attributes.add(createTimeTuple(Constants.DEPARTURE_TIME, dep.getDepartureTime()));
if (dep.getVehicleId() != null) {
attributes.add(createTuple(Constants.VEHICLE_REF_ID, dep.getVehicleId().toString()));
}
if (AttributesUtils.isEmpty(dep.getAttributes())) {
this.writeStartTag(Constants.DEPARTURE, attributes, true);
} else {
this.writeStartTag(Constants.DEPARTURE, attributes, false);
this.writer.write(NL);
this.attributesWriter.writeAttributes("\t\t\t\t\t", this.writer, dep.getAttributes());
this.writeEndTag(Constants.DEPARTURE);
}
}
this.writeEndTag(Constants.DEPARTURES);
}
}