diff --git a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java index 15af77ce3f5..126eff63188 100644 --- a/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java +++ b/contribs/application/src/main/java/org/matsim/freightDemandGeneration/DemandReaderFromCSV.java @@ -1134,14 +1134,14 @@ private static void reduceNumberOfJobsIfSameCharacteristics(Scenario scenario, "The number of Jobs will be reduced if jobs have the same characteristics (e.g. time, location, carrier)"); int connectedJobs = 0; if (newDemandInformationElement.getTypeOfDemand().equals("shipment")) { - HashMap, CarrierShipment> shipmentsToRemove = new HashMap, CarrierShipment>(); - ArrayList shipmentsToAdd = new ArrayList(); + HashMap, CarrierShipment> shipmentsToRemove = new HashMap<>(); + ArrayList shipmentsToAdd = new ArrayList<>(); Carrier thisCarrier = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)); for (Id baseShipmentId : thisCarrier.getShipments().keySet()) { if (!shipmentsToRemove.containsKey(baseShipmentId)) { CarrierShipment baseShipment = thisCarrier.getShipments().get(baseShipmentId); - HashMap, CarrierShipment> shipmentsToConnect = new HashMap, CarrierShipment>(); + HashMap, CarrierShipment> shipmentsToConnect = new HashMap<>(); shipmentsToConnect.put(baseShipmentId, baseShipment); for (Id thisShipmentId : thisCarrier.getShipments().keySet()) { if (!shipmentsToRemove.containsKey(thisShipmentId)) { @@ -1185,14 +1185,14 @@ private static void reduceNumberOfJobsIfSameCharacteristics(Scenario scenario, log.warn("Number of reduced shipments: {}", connectedJobs); } if (newDemandInformationElement.getTypeOfDemand().equals("service")) { - HashMap, CarrierService> servicesToRemove = new HashMap, CarrierService>(); - ArrayList servicesToAdd = new ArrayList(); + HashMap, CarrierService> servicesToRemove = new HashMap<>(); + ArrayList servicesToAdd = new ArrayList<>(); Carrier thisCarrier = CarriersUtils.getCarriers(scenario).getCarriers() .get(Id.create(newDemandInformationElement.getCarrierName(), Carrier.class)); for (Id baseServiceId : thisCarrier.getServices().keySet()) { if (!servicesToRemove.containsKey(baseServiceId)) { CarrierService baseService = thisCarrier.getServices().get(baseServiceId); - HashMap, CarrierService> servicesToConnect = new HashMap, CarrierService>(); + HashMap, CarrierService> servicesToConnect = new HashMap<>(); servicesToConnect.put(baseServiceId, baseService); for (Id thisServiceId : thisCarrier.getServices().keySet()) { if (!servicesToRemove.containsKey(thisServiceId)) { @@ -1248,7 +1248,7 @@ private static HashMap, Link> findAllPossibleLinks(Scenario scenario, Integer numberOfLocations, String[] areasForLocations, String[] setLocations, HashMap, Person> possiblePersons, HashMap, HashMap> nearestLinkPerPerson) { - HashMap, Link> possibleLinks = new HashMap, Link>(); + HashMap, Link> possibleLinks = new HashMap<>(); if (numberOfLocations == null) { for (Link link : scenario.getNetwork().getLinks().values()) if (!link.getId().toString().contains("pt") && (!link.getAttributes().getAsMap().containsKey( @@ -1324,7 +1324,7 @@ private static HashMap, Person> findPossiblePersons(Population popula String[] areasForJobElementLocations, ShpOptions.Index indexShape, CoordinateTransformation crsTransformationNetworkAndShape) { - HashMap, Person> possiblePersons = new HashMap, Person>(); + HashMap, Person> possiblePersons = new HashMap<>(); for (Person person : population.getPersons().values()) { Coord coord = getHomeCoord(person); @@ -1406,7 +1406,7 @@ private static Link findPossibleLinkForDemand(HashMap, Link> possibleLi ShpOptions.Index indexShape, String[] areasForTheDemand, Integer selectedNumberOfLocations, Scenario scenario, String[] selectedLocations, CoordinateTransformation crsTransformationNetworkAndShape) { Link selectedlink = null; - Link newLink = null; + Link newLink; if (selectedNumberOfLocations == null) selectedNumberOfLocations = 0; while (selectedlink == null) {