void (List<String> list) { @NonNls final String foo = "foo".toUpperCase(); final String bar = foo.toLowerCase(); // foo is @NonNls: this is enough @NonNls List<String> res = list.stream().map(String::toUpperCase).collect(Collectors.toList()); @NonNls List<String> res2 = list.stream().map(s -> s.toUpperCase()).collect(Collectors.toList()); }