this code is copied from a reference but it shows compilation error in Intellj:
Stream locales = Stream.of(Locale.getAvailableLocales());
Map<String, Set<String>> countryToLanguages = locales.collect(
groupingBy(l -> l.getDisplayCountry(),
mapping(l -> l.getDisplayLanguage(),
toSet())));
the compiler is seeing object named "l" and a java Object not as a locale; so it cann't understand the methods l.getDisplayCountry() and l.getDisplayLanguage().
also the Project SDK is java 8 and project language level is 8- lambdas, type annotations etc.