I have a Map<Double, List<String>> that contains the following elements:
{1.0=[AP], 2.2=[AB], 2.5=[AC], 3.5=[AD], 4.5=[AE, AF], 6.30000000000001=[AG]}
I wish to add these elements into a List so that it would print out like so or print them out like so:
[AP 1.0, AB 2.2, AC 2.5, AD 3.5 , AE 4.5, AF 4.5, AG 6.3]
How would I go about doing this?
I have tried the following
Map<Double, List<String>> mapToPopulate = new TreeMap<Double, List<String>>();
List <String> output = new ArrayList<>();
// after populating map
for(Double d: mapToPopulate .keySet()) {
result.add(mapToPopulate.get(d) + " " + d);}
but it prints it out in this form
[[AP] 1.0,[AB] 2.2,[AC] 2.5,[AD] 3.5, [AE, AF] 4.5,[AG] 6.30000000000001]