问题描述:
idea在使用到 lambda 表达式的时候,给出了如下错误:
Lambda expressions are not supported at language level ‘5’
解决方式:
查看项目的以下设置
- File > Project Structure > Project > Project SDK: Change it to Java 1.8.XX
- File > Project Structure > Project > Language Level: SDK 8
- File > Project Structure > Modules > Sources > SDK 8
- File > Settings > Build, Execution, Deployment > Compiler > Java Compiler > Project bytecode version > 1.8
- File > Settings > Build, Execution, Deployment > Compiler > Java Compiler > Per-module bytecode version > Target bytecode version > 1.8
一般来说,按照上边的设置完成之后,就可以正常使用 Lambda 表达式了。希望有助于各位!
本文章经验参考:https://blog.csdn.net/sky_jiangcheng/article/details/80397061