Here you can find the source of saveData(Map
public static void saveData(Map<String, Map<String, Double>> data, String file)
//package com.java2s; //License from project: Open Source License import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Map; public class Main { public static void saveData(Map<String, Map<String, Double>> data, String file) { //Map<String, OntologyUtils.Term> utils = new OntologyUtils().getGOHierarchy(); try {// w w w . j ava2 s .c o m File f = new File(file); if (!f.exists()) { f.createNewFile(); } FileWriter fw = new FileWriter(f.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); //for(String s:mapping.keySet()){ // bw.write("\t" + s); //} bw.newLine(); boolean column = false; for (String c : data.keySet()) { if (!column) { for (String g : data.get(c).keySet()) { bw.write("\t" + g); } column = true; bw.newLine(); } bw.write(c); for (String g : data.get(c).keySet()) { //System.out.println(c + "\t" + g + "\t" + mapping.get(c).get(g)); bw.write("\t" + data.get(c).get(g)); } bw.newLine(); } bw.close(); } catch (IOException io) { } } }