'Cannot fix error when trying to create a map based on a list using Java streams

I am trying to create a hashmap using an arraylist of values.

//Map to store collected values in    
Map<String, Boolean> stringMap = new HashMap<>();

//List of strings to use to make map
ArrayList<String> strings = getStrings();

stringMap = strings.stream()
.collect(Collectors.toMap(Function.identity(), new Boolean.FALSE));

I keep getting an error on the .collect line and I think it's related to setting each boolean value in the map to false.

I've seen tutorials on streams where this should work:

I know it is related to the boolean value. I've tried just putting false there or Boolean.valueOf(FALSE) and a number of other things to take care of this, but I keep getting errors.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source