private ImmutableList<String> saveFilesOnDisk(ImmutableMap<String,String> swaggerFilePathToContentMap){
  List<String> savedfilePaths=new ArrayList<>();
  File tempDir=Files.createTempDir();
  String tmpDirLocation=tempDir.getAbsolutePath();
  for (  Entry<String,String> entry : swaggerFilePathToContentMap.entrySet()) {
    String filePath=entry.getKey();
    String fileContent=entry.getValue();
    Preconditions.checkState(!Strings.isNullOrEmpty(fileContent),"swagger spec file contents empty");
    Preconditions.checkState(!Strings.isNullOrEmpty(filePath),"swagger spec file path not provided");
    String filePathToSave=File.separator + tmpDirLocation + File.separator+ "swagger_spec_files"+ File.separator+ filePath;
    try {
      String savedFilePath=saveFileOnDisk(filePathToSave,fileContent);
      savedfilePaths.add(savedFilePath);
    }
 catch (    IOException e) {
      throw new IllegalStateException(String.format("Unable to save the swagger spec contents on the disk at %s",filePathToSave),e);
    }
  }
  return ImmutableList.copyOf(savedfilePaths);
}

private ImmutableList < String > saveFilesOnDisk ( ImmutableMap < String , String > swaggerFilePathToContentMap ) { List < String > savedfilePaths = new ArrayList < > ( ) ; File tempDir = Files . createTempDir ( ) ; String tmpDirLocation = tempDir . getAbsolutePath ( ) ; for ( Entry < String , String > entry : swaggerFilePathToContentMap . entrySet ( ) ) { String filePath = entry . getKey ( ) ; String fileContent = entry . getValue ( ) ; Preconditions . checkState ( ! Strings . isNullOrEmpty ( fileContent ) , "swagger spec file contents empty" ) ; Preconditions . checkState ( ! Strings . isNullOrEmpty ( filePath ) , "swagger spec file path not provided" ) ; String filePathToSave = File . separator + tmpDirLocation + File . separator + "swagger_spec_files" + File . separator + filePath ; try { String savedFilePath = saveFileOnDisk ( filePathToSave , fileContent ) ; savedfilePaths . add ( savedFilePath ) ; } catch ( IOException e ) { throw new IllegalStateException ( String . format ( "Unable to save the swagger spec contents on the disk at %s" , filePathToSave ) , e ) ; } } return ImmutableList . copyOf ( savedfilePaths ) ; }
saves the file contents on the disk and returns the saved file paths .
