Android N中的Java 8 Stream API [英] Java 8 Stream API in Android N

查看:367
本文介绍了Android N中的Java 8 Stream API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 Google的介绍,从Android N,Android API应该支持Java流。

According to Google's introduction, starting with Android N, the Android API is supposed to support Java streams.

然而,使用Android N预览SDK,我无法在我的项目中使用任何Stream API (使用Android N作为最低配置,目标和构建SDK版本)。

However, using the Android N preview SDK, I am unable to use any of the Stream APIs in my project (which is configured with Android N as minimum, target and build SDK version).

java.util.stream 包似乎丢失了,我试过的所有集合实现的 stream()方法也是如此。

The java.util.stream package seems to be missing, as are the stream() methods of all collection implementations I've tried.

SDK的当前预览版中是否还包含必要的类?

Are the necessary classes not yet included in the current preview release of the SDK?

推荐答案

它还没有出现在当前预览中,但它已经合并到AOSP Git大师。请参阅此处 https://android.googlesource.com/platform/libcore/+/916b0af2ccdd1bdfc0283b1096b291c40997d05f

It's not yet in the current preview, but it has already been merged into the AOSP Git master. See here https://android.googlesource.com/platform/libcore/+/916b0af2ccdd1bdfc0283b1096b291c40997d05f

编辑:

为避免可能的混淆:3月2016年,当OP询问此问题时,Android N开发者 preview-1 是现在称为Android 7.0Nougat的唯一公开版本。

Just to avoid possible confusion: in March 2016, when this question has been asked by the OP, Android N developer preview-1 was the only publicly available build of what is now known as Android 7.0 "Nougat".

preview-1 构建实际上并没有包含Java 8 Stream API,但它很快就被添加了(一个月后)在开发者 preview-2 build。

The preview-1 build did in fact not include the Java 8 Stream API, but it was added shortly after (one month later) in the developer preview-2 build.

所以,Android 7.0 API级别24 现在支持Java 8 Stream API。

So, Android 7.0 API level 24 does support the Java 8 Stream API now.

这篇关于Android N中的Java 8 Stream API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆