A Small Test of Lambda Expression in Android Studio
My earlier post verified that Android Studio version 3.2.1 by default uses Java version 8. Since that Java version, the Lambda Expression language feature has been available. I wanted to experiment a few lines of Lambda in Android Studio.
The test result of my few lines of code showed that I was able to build a minimal test app having Lambda Expression used, as shown in this screenshot:
Here is the simple function tested:
Note that the java.util.function package that I used requires Android SDK API Level 24 or higher. Refer to the official Android Studio User Guide about the Java 8 language features.
The test result of my few lines of code showed that I was able to build a minimal test app having Lambda Expression used, as shown in this screenshot:
![]() |
| A small test of Lambda function in Android Studio by Calmalgo.com |
Here is the simple function tested:
Function<Integer[], Double> mean = (array) -> { double sum = 0d; for (int num: array) sum += num; return sum / array.length; };
Note that the java.util.function package that I used requires Android SDK API Level 24 or higher. Refer to the official Android Studio User Guide about the Java 8 language features.

Comments
Post a Comment