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() { private List<Set<Train>> getCollisionsOfOneReverseStep() {
List<Set<Train>> collisions = new ArrayList<>(); List<Set<Train>> collisions = new ArrayList<>();
Map<Train, Set<Rail>> occupiedRails = new HashMap<>(); Map<Train, Set<Rail>> occupiedRails = trains.values().stream().filter(Train::isPlaced)
for (Train train : trains.values()) { .collect(Collectors.toMap(Function.identity(), Train::getOccupiedRails));
if (train.isPlaced()) {
occupiedRails.put(train, train.getOccupiedRails());
}
}
// perform step // perform step
Map<Train, Set<Rail>> nextOccupiedRails = new HashMap<>(); Map<Train, Set<Rail>> nextOccupiedRails = new HashMap<>();
trains.values().stream().filter(Train::isPlaced).forEach(train -> { trains.values().stream().filter(Train::isPlaced).forEach(train -> {