- this answer doesn't math: How to store enum to map using Java 8 stream API
I have an enum:
public enum SheetRows{
totalActive("Total active");
String value;
SheetRows(String value){
this.value = value;
}
public String getValueForTable() {
return value;
}
}
How to convert this enum to HashMap<SheetRows, String>
?
I try to use:
HashMap<SheetRows, String> cellsMap = Arrays.asList(SheetRows.values()).stream()
.collect(Collectors.toMap(k -> k, v -> v.getValueForTable()));
but this code isn't compile.