Workspaces don't support Java 8+ streams?
I'm trying to use a stream to print out all of the words in the description and it is not working (code below):
import java.util.stream; //... blogPost.getDescriptionWords.stream().forEach(System.out::println);
This is the error I'm getting:
Example.java:2: error: cannot find symbol import java.util.stream; ^ symbol: class stream location: package java.util Example.java:10: error: cannot find symbol blogPost.getDescriptionWords().stream().forEach(System.out::println); ^ symbol: method stream() location: class String 2 errors
I solved the problem. My mistake was treating an array like it was a list. Here is what I should have done:
import java.util.Arrays; //... Arrays.stream(blogPost.getDescriptionWords()).forEach(System.out::println);
Also, I didn't need to import "java.util.stream", I guess streams are just in Java by default now.