@SuppressWarnings("SpellCheckingInspection")
    private void printMostActiveActorInSingleYear(final List<Movie> movies, final Set<Actor> actors) {
        // Java 7 style.
        final Map<Actor, Map<Long, Long>> actorToMoviePerYearCount = new HashMap<>();
        for (final Movie movie : movies)
            for (final Actor actor : movie.getActors()) {
                final Map<Long, Long> yearToMovieCount = actorToMoviePerYearCount.containsKey(actor)
                                                         ? actorToMoviePerYearCount.get(actor) : new HashMap<>();
                final long year = movie.getReleaseYear();
                yearToMovieCount.put(year, 1 + (yearToMovieCount.containsKey(year) ? yearToMovieCount.get(year) : 0));
                actorToMoviePerYearCount.put(actor, yearToMovieCount);
            }
        long maximumMovieCount = 0;
        Actor mostProductiveActor = null;
        long mostProductiveYear = 0;
        for (final Actor actor : actorToMoviePerYearCount.keySet())
            for (final long year : actorToMoviePerYearCount.get(actor).keySet()) {
                if (actorToMoviePerYearCount.get(actor).get(year) > maximumMovieCount) {
                    maximumMovieCount = actorToMoviePerYearCount.get(actor).get(year);
                    mostProductiveActor = actor;
                    mostProductiveYear = year;
                }
            }
        System.out.println();
        if (mostProductiveActor != null)
            System.out.println("Java 7 - most productive actor in a single year: " + mostProductiveActor.getFullName()
                               + ", who worked on " + maximumMovieCount + " movies in " + mostProductiveYear + ".");
        else
            System.out.println("Java 7 - most productive actor in a single year not found?!?");

        // Java 8 style.
        // todo: rewrite to improve performance, for example by having the movies as the "outer loop".
        // Disabled the code below for the moment.
        System.out.println("Java 8 - most productive actor in a single year: to be optimized...");
        if (movies.size() == -1) {
            final Map.Entry<Actor, Map.Entry<Integer, Long>> actorYearCountEntry = actors.stream().parallel()
                .collect(Collectors.toMap(
                    Function.identity(),
                    actor -> movies.stream().filter(movie -> movie.getActors().contains(actor))
                        .collect(Collectors.groupingBy(Movie::getReleaseYear, Collectors.counting()))
                        .entrySet().stream().max(Map.Entry.comparingByValue()).get()))
                .entrySet().stream().max(Comparator.comparing(entry -> entry.getValue().getValue())).get();
            System.out.println("Most productive actor in a single year: " + actorYearCountEntry.getKey().getFullName());
            System.out.println("Year: " + actorYearCountEntry.getValue().getKey());
            System.out.println("Movie count: " + actorYearCountEntry.getValue().getValue());
            System.out.println();
        }
    }