private void printYearWithMostMovies(final List<Movie> movies) {
        // Java 7 style.
        final Map<Integer, Integer> yearToMovieCount = new HashMap<>();
        for (final Movie movie : movies) {
            final int year = movie.getReleaseYear();
            yearToMovieCount.put(year, 1 + (yearToMovieCount.containsKey(year) ? yearToMovieCount.get(year) : 0));
        }
        int maximumMovieCount = 0;
        int maximumMovieYear = 0;
        for (int year : yearToMovieCount.keySet()) {
            final int movieCount = yearToMovieCount.get(year);
            if (movieCount > maximumMovieCount) {
                maximumMovieCount = movieCount;
                maximumMovieYear = year;
            }
        }
        System.out.println();
        System.out.println("Java 7 - maximum movie year: " + maximumMovieYear + ", when " + maximumMovieCount
                           + " movies were released.");

        // Java 8 style.
        final Map.Entry<Integer, Long> yearAndCountEntry = movies.stream()
            .collect(Collectors.groupingBy(Movie::getReleaseYear, Collectors.counting()))
            .entrySet().stream()
            .max(Map.Entry.comparingByValue())
            .get();
        System.out.println("Java 8 - maximum movie year: " + yearAndCountEntry.getKey()
                           + ", when " + yearAndCountEntry.getValue() + " movies were released.");
    }