I am currently browsing the Javaslang library and I am trying to convert part of my code to Javaslang.
I currently have this bit of code, which is completely pure Java
Cell[][] maze; //from input
Map<Cell, Long> cellCounts = Stream.of(maze)
.flatMap(Stream::of)
.collect(groupingBy(c -> c, counting()));
I was looking to convert this to Javaslang since I am interested in the library and I just wanted to play with it.
I am trying to do a similar thing, but converting to a Javaslang map instead of java.util.Map.
I have tried this so far, but then I am stuck because I cannot convert it.
Array.of(maze)
.flatMap(Array::of)
So, I have a list of Cell objects, but I'm trying to figure out how to convert it to javaslang.collection.Map
* EDIT *
I looked at getting my original java.util.Map on javaslang.collections.Hashmap with this
HashMap<Cell, Long> cellsCount = HashMap.ofEntries(cellCounts
.entrySet()
.toArray(new Map.Entry[0]));
Javaslang, .