本文介绍了是否可以在Android API上使用Java 8 Stream API< 24?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我已经读过这个发布。但是我仍然无法在minSdkVersion<上运行包含Java 8 Stream API功能的代码,如下所示: 24。I've read this post here. But still I cannot run code containing Java 8 Stream API features like the following on minSdkVersion < 24.List<Car> newCars = cars.stream() .filter(s -> s.getColor().equals("red")) .collect(Collectors.toList());由于错误消息,这不会运行This doesn't run due to the error message那么有人知道解决方案吗?So does someone know a solution?推荐答案您不能在API级别上使用Java8流< 24。You can not use Java8 streams on API level < 24.然而,有一些库反向移植了一些流功能However, there are some libraries that backport some of the stream functionality https://github.com/aNNiMON/Lightweight-Stream-API https://github.com/konmik/solid https://sourceforge.net/projects/streamsupport/ (@sartorius在评论中提到)https://sourceforge.net/projects/streamsupport/ (mentioned by @sartorius in comment) 这篇关于是否可以在Android API上使用Java 8 Stream API< 24?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-26 17:31