%%loadFromPOM
<dependency>
    <groupId>jfree</groupId>
    <artifactId>jfreechart</artifactId>
    <version>1.0.13</version>
</dependency>
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;


List<String> TheList = new ArrayList<String>();


public class StemAndLeaf {

	public static String createPlot() {

            List<Double> sorted = new ArrayList<Double>();
            sorted.add(1.0);
            sorted.add(2.0);
            sorted.add(15.0);
            sorted.add(35.0);
            sorted.add(115.0);
            sorted.add(135.5);

            TreeMap<Integer, List<Double>> stemPlot = new TreeMap<>();


            for(int i = 0;  i < sorted.size(); i++) {
                int stem = (int)(sorted.get(i) / 10.0);
                double leaf = sorted.get(i) % 10;

                if (!stemPlot.containsKey(stem)) {
                    stemPlot.put(stem, new ArrayList<>());
                }
                
                stemPlot.get(stem).add(leaf);

            }

            String plot = new String();

            for(Integer i : stemPlot.keySet()) {
                if (i < 10) plot+= "| " + i + "  | ";
                else plot += "| " + i + " | ";
                for (Double j : stemPlot.get(i)) {
                    plot+=""+j+" ";
                }
                plot+="\n";
            }

            return plot;

    }

}

System.out.println(StemAndLeaf.createPlot());
| 0  | 1.0 2.0 
| 1  | 5.0 
| 3  | 5.0 
| 11 | 5.0 
| 13 | 5.5