title: Java print items in tree map list
body: <p>I currently have a TreeMap of the form <code>&lt;String, List&lt;List&lt;String&gt;&gt;</code> </p>
  
  <p>I'm trying to write my tree map to an output file where I get the inner values of my string[] all separated by a colon. </p>
  
  <p>Do I need a second for loop to loop through each inner list and format it using a <code>.join(":", elements)</code>? </p>
  
  <p>Or is there a more concise way to keep it all in a single for loop statement?</p>
  
  <p>I've tried a few things and my current code is:</p>
  
  <pre><code>new File(outFolder).mkdir();
  File dir = new File(outFolder);
  //get the file we're writing to
  File outFile = new File(dir, "javaoutput.txt");
  //create a writer
  try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) { 
    for (Map.Entry&lt;String, String[]&gt; entry : allResults.entrySet()) {
      writer.write(entry.getKey() + ", "+ Arrays.toString(entry.getValue()).replace("null", "").toString());
      writer.newLine();   
    }
  </code></pre>
  
  <p><strong>Current output:</strong></p>
  
  <blockquote>
    <p>ANY, [[469, 470], [206, 1013, 1014], [2607, 2608]]</p>
  </blockquote>
  
  <p><strong>Desired output:</strong></p>
  
  <blockquote>
    <p>ANY, 469:470, 206:1013:1014, 2607:2608</p>
  </blockquote>
  
  <p>Any suggestions would be greatly appreciated.</p>