public static void merge(File f, TreeMap<String, ArrayList<String>> map) {
		BufferedReader br = null;
		try {
			br = new BufferedReader(new FileReader(f));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			 e.printStackTrace();
		}
		try {
			File outfile = new File(fileoutname);
			BufferedWriter bw = new BufferedWriter(new FileWriter(outfile,
					false));

			Set<String> mapwords = map.keySet();
			Iterator<String> mapit = mapwords.iterator();
			String line = "";
			String fileword = "";
			String mapword = mapit.next();
			while (mapit.hasNext()) {
				line = br.readLine();
				if (line == null) {
					break;
				}
				// System.out.println("Line "+line);
				int loc = line.indexOf(TagName.equal);
				fileword = line.substring(0, loc);
				int flag = mapword.compareTo(fileword);
				if (flag < 0) {
					StringBuffer sb = createValueString(mapword,
							map.get(mapword));
					sb.append(TagName.newline);
					bw.append(sb);
					mapword = mapit.next();
				} else if (flag > 0) {
					bw.append(line);
					line = br.readLine();
				} else if (flag == 0) {
					StringBuffer sb = new StringBuffer();
					sb.append(line);
					sb.append(createValue(map.get(mapword)));
					sb.append(TagName.newline);
					bw.append(sb);
					line = br.readLine();
					mapword = mapit.next();
				}
			}
			while (mapit.hasNext()) {
				mapword = mapit.next();
				StringBuffer sb = createValueString(mapword, map.get(mapword));
				sb.append(TagName.newline);
				bw.append(sb);
				// mapit.next();
			}
			line = br.readLine();
			while (line != null) {
				bw.append(line);
				bw.newLine();
				line = br.readLine();
			}
			bw.close();
			String temp = filein;
			// filein = fileout;
			// fileout = temp;
		} catch (Exception e) {
			 e.printStackTrace();
		}

	}