Source:
public void setReplay(Replay replay) { this.replay = replay; Optional<MapBean> optionalMap = Optional.ofNullable(replay.getMap()); if (optionalMap.isPresent()) { MapBean map = optionalMap.get(); Image image = mapService.loadPreview(map, PreviewSize.SMALL); mapThumbnailImageView.setImage(image); onMapLabel.setText(i18n.get("game.onMapFormat", map.getDisplayName())); } else { onMapLabel.setText(i18n.get("game.onUnknownMap")); } gameTitleLabel.setText(replay.getTitle()); dateLabel.setText(timeService.asDate(replay.getStartTime())); timeLabel.setText(timeService.asShortTime(replay.getStartTime())); modLabel.setText(replay.getFeaturedMod().getDisplayName()); playerCountLabel.setText(i18n.number(replay.getTeams().values().stream().mapToInt(List::size).sum())); double gameQuality = ratingService.calculateQuality(replay); if (Double.isNaN(gameQuality)) { qualityLabel.setText(i18n.get("percentage", Math.round(ratingService.calculateQuality(replay) * 100))); } else { qualityLabel.setText("-"); } replay.getTeamPlayerStats().values().stream() .flatMapToInt(playerStats -> playerStats.stream() .mapToInt(stats -> RatingUtil.getRating(stats.getBeforeMean(), stats.getBeforeDeviation()))) .average() .ifPresent(averageRating -> ratingLabel.setText(i18n.number((int) averageRating))); durationLabel.setText(Optional.ofNullable(replay.getEndTime()) .map(endTime -> timeService.shortDuration(Duration.between(replay.getStartTime(), endTime))) .orElse(i18n.get("notAvailable"))); String players = replay.getTeams().values().stream() .map(team -> Joiner.on(i18n.get("textSeparator")).join(team)) .collect(Collectors.joining(i18n.get("vsSeparator"))); playerListLabel.setText(players); ObservableList<Review> reviews = replay.getReviews(); JavaFxUtil.addListener(reviews, new WeakInvalidationListener(reviewsChangedListener)); reviewsChangedListener.invalidated(reviews); }

Target:
public void setReplay(Replay replay) { this.replay = replay; Optional<MapBean> optionalMap = Optional.ofNullable(replay.getMap()); if (optionalMap.isPresent()) { MapBean map = optionalMap.get(); Image image = mapService.loadPreview(map, PreviewSize.SMALL); mapThumbnailImageView.setImage(image); onMapLabel.setText(i18n.get("game.onMapFormat", map.getDisplayName())); } else { onMapLabel.setText(i18n.get("game.onUnknownMap")); } gameTitleLabel.setText(replay.getTitle()); dateLabel.setText(timeService.asDate(replay.getStartTime())); timeLabel.setText(timeService.asShortTime(replay.getStartTime())); modLabel.setText(replay.getFeaturedMod().getDisplayName()); playerCountLabel.setText(i18n.number(replay.getTeams().values().stream().mapToInt(List::size).sum())); double gameQuality = ratingService.calculateQuality(replay); if (!Double.isNaN(gameQuality)) { qualityLabel.setText(i18n.get("percentage", Math.round(gameQuality * 100))); } else { qualityLabel.setText(i18n.get("gameQuality.undefined")); } replay.getTeamPlayerStats().values().stream() .flatMapToInt(playerStats -> playerStats.stream() .mapToInt(stats -> RatingUtil.getRating(stats.getBeforeMean(), stats.getBeforeDeviation()))) .average() .ifPresent(averageRating -> ratingLabel.setText(i18n.number((int) averageRating))); durationLabel.setText(Optional.ofNullable(replay.getEndTime()) .map(endTime -> timeService.shortDuration(Duration.between(replay.getStartTime(), endTime))) .orElse(i18n.get("notAvailable"))); String players = replay.getTeams().values().stream() .map(team -> Joiner.on(i18n.get("textSeparator")).join(team)) .collect(Collectors.joining(i18n.get("vsSeparator"))); playerListLabel.setText(players); ObservableList<Review> reviews = replay.getReviews(); JavaFxUtil.addListener(reviews, new WeakInvalidationListener(reviewsChangedListener)); reviewsChangedListener.invalidated(reviews); }