0

As per the doc, android supports java 8 Stream functionality, but the below code is not working for me

ArrayList<Student> students= new ArrayList<>();
List<Integer> idList = students.stream().map(Student::getId).collect(Collectors.toList());

It gives cannot resolve method stream() error.

I have enabled the java 8 in my project

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

Is android not supporting the Collection.stream() API yet?

Abhishek V
  • 12,278
  • 6
  • 47
  • 62

0 Answers0