private MultipartFile findByFileName(String filename,Map<String,MultipartFile> files){
  if (files.containsKey(filename)) {
    return files.get(filename);
  }
  for (  MultipartFile file : files.values()) {
    if (filename.equals(file.getOriginalFilename())) {
      return file;
    }
  }
  return null;
}

private MultipartFile findByFileName ( String filename , Map < String , MultipartFile > files ) { if ( files . containsKey ( filename ) ) { return files . get ( filename ) ; } for ( MultipartFile file : files . values ( ) ) { if ( filename . equals ( file . getOriginalFilename ( ) ) ) { return file ; } } return null ; }
tries to find request part or file with specified name in multipart files map .
