Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 8 Stream API in Android N

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

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).

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

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

like image 244
lxgr Avatar asked Mar 20 '16 09:03

lxgr


1 Answers

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

EDIT:

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".

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.

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

like image 166
Stefan Zobel Avatar answered Sep 21 '22 17:09

Stefan Zobel