import static java.util.stream.Collectors.*;
import java.util.*;
import java.lang.*;
//import java.util.Collections;
public class HelloWorld{
public static void main(String []args){
System.out.println("Hello World");
List<String> strings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl");
List<String> filtered = strings.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());
}
}
output
/tmp/java_tdo3eB/HelloWorld.java:10: error: cannot find symbol
List<String> filtered = strings.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());
^
symbol: variable Collectors
location: class HelloWorld
1 error
So i query is why i am unable to use Collectors as i have import that class also