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

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

However, the Stream library (java.util.stream) is only supported for API 24 and above. Can someone shed some light on why this is so? This does not make sense to me, since, as I understand it, adding a stream API makes an unnecessary change to the JVM, as opposed to adding lambdas or default methods; does it just use Java 8 features like the default methods for collections and add new code to the java util library?

+5
source share
1 answer

Can someone shed some light on why this is so?

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

it just uses Java 8 features, such as the default methods for collections, and adds some new code to the java util library?

Right. However, Google does not have the means to modify the java.util classes in previous versions of Android. The problem with adding new java.util classes through the library will be the problem.

+6
source

Source: https://habr.com/ru/post/1276283/


All Articles