Hi, I am working on a sumo project. I am using TraCI 4J to control the simulation. I am stuck in a simple problem:
for (int i = 0; i < 37260; i++) {
Collection<Vehicle> vehicles = conn.getVehicleRepository().getAll().values();
Iterator<Vehicle> itr = vehicles.iterator();
while (itr.hasNext()) {
Vehicle vehicle = itr.next();
if(vehicle.getType()=="typeNS")
System.out.println("Found typeNS");
if(vehicle.getType()=="typeWE")
System.out.println("Found typeWE");
System.out.println(vehicle.getType());
}
}
The last output gives every possible vehicle.getType but the top if statement always get ommitted. There are hundres of typeNS and typeWE but it does not catch that. Any idea? What's the problem here?