I wanted to collect the result to a TreeMap<Integer,Double> by processing a
TreeMap<Integer,ArrayList<String>>.
TreeMap<Integer,Double> result2 = units.entrySet().stream()
.filter(v -> v.getValue().size()>3)
.filter(v -> !v.getValue().get(1).isEmpty() && !v.getValue().get(2).isEmpty())
.mapToDouble(v -> mult( v.getValue().get(1), v.getValue().get(2)))
.collect();
Basically what I am doing is that I get the values from the ArrayList of Strings from the stream, and filter out the ones with no values and get a product of the 2nd and 3rd element by using mult function inside the lambda expression. Now I don't know how to collect to a TreeMap where the key is the key of the processed TreeMap called units and the value should be the product that I calculated in the mapToDouble.
NOTE: units is a TreeMap<Integer,ArrayList<String>>