I was working on Java8 and found collector is failing when i use null in hashmap.
I am getting null pointer exception . My query is if hash map allows null values then why i am getting null pointer here.
public class Test {
public static void main(String[] args) {
HashMap<String, String> m = new HashMap<>();
m.put("abc", null);
m.entrySet().parallelStream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
}
}