Why are Java 8 Streams only available from API level 24?

AAryz :

Supported Java 8 Language Features and APIs states that we can use default methods and lambda expressions in android projects with any min sdk API level.

However, the Stream library (java.util.stream) is only supported for API 24 and higher. Can somebody please shed some light on why this is the case? To me it does not make sense, because as far as I understand, the addition of stream API does not require JVM modification unlike the addition of lambdas or default methods; it simply leverages Java 8 features like default methods on collections and adds some new code to java util library?

CommonsWare :

Can somebody please shed some light on why this is the case?

Because Google does not have a time machine. Or, if they are, they are not using it to "retcon" previous versions of Android.

it simply leverages Java 8 features like default methods on collections and adds some new code to java util library?

Correct. However, Google has no means of changing java.util classes on previous versions of Android. Even adding new java.util classes via a library would be a problem.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=468987&siteId=1