Checkstyle

This commit is contained in:
Arne Keller 2020-02-22 18:02:53 +01:00
parent c82ab689d4
commit 40cc52d2a3

View File

@ -249,12 +249,8 @@ public final class TrainManager {
*/
private List<Set<Train>> getCollisionsOfOneReverseStep() {
List<Set<Train>> collisions = new ArrayList<>();
Map<Train, Set<Rail>> occupiedRails = new HashMap<>();
for (Train train : trains.values()) {
if (train.isPlaced()) {
occupiedRails.put(train, train.getOccupiedRails());
}
}
Map<Train, Set<Rail>> occupiedRails = trains.values().stream().filter(Train::isPlaced)
.collect(Collectors.toMap(Function.identity(), Train::getOccupiedRails));
// perform step
Map<Train, Set<Rail>> nextOccupiedRails = new HashMap<>();
trains.values().stream().filter(Train::isPlaced).forEach(train -> {