Here you can find the source of deleteTempFiles(Map
private static void deleteTempFiles(Map<String, File> fileMap, String templateFileName)
//package com.java2s; import java.io.File; import java.util.Iterator; import java.util.Map; public class Main { private static void deleteTempFiles(Map<String, File> fileMap, String templateFileName) { boolean isSuccess = true; Iterator<File> fileIt = fileMap.values().iterator(); while (fileIt.hasNext()) { File file = fileIt.next(); isSuccess = file.delete();/*ww w .j av a 2 s .c om*/ } File file = new File(templateFileName); try { if (file.exists() && isSuccess) { isSuccess = file.delete(); } } catch (Exception ex) { ex.printStackTrace(); } } }