entities.stream().filter(m->m.getId()==id).findAny().get();
其中实体是列表.将所有库和其他SDK设置为Java 8.之后,我们会收到以下错误:
use -source 8 or higher to enable lambda expressions
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build>