Java 脱机同步文件:上载ArrayList或在for循环中上载

Java 脱机同步文件:上载ArrayList或在for循环中上载,java,android,performance,asynchronous,upload,Java,Android,Performance,Asynchronous,Upload,我基本上是一名Java开发人员,只掌握Android开发的基本信息。我开发了一个web端点,它接受一个文件和一些其他参数。java代码是 @RequestMapping(path = "/api/beneficiary/initial/inspection/upload", method = RequestMethod.POST, produces = "application/json") public @ResponseBody String uploadInitialInspectionP

我基本上是一名Java开发人员,只掌握Android开发的基本信息。我开发了一个web端点,它接受一个文件和一些其他参数。java代码是

@RequestMapping(path = "/api/beneficiary/initial/inspection/upload", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody String uploadInitialInspectionPhoto(@RequestParam(value = "uploadImg") MultipartFile file,
        @RequestParam("hdId") Long hdId, @RequestParam("toRegId") String toRegId,
        @RequestParam(value = "remark", required = false) String remark,
        @RequestParam(value="latitude")String latitude,
        @RequestParam(value="longitude")String longitude) {
//.... Method Code
}
我的Android开发者说,在异步后台线程上上传10个文件需要10分钟,因为它必须点击URL 10次。她建议我将API改为接受ArrayList。i、 e将接口更改为

@RequestMapping(path = "/api/beneficiary/initial/inspection/upload", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody String uploadInitialInspectionPhoto(@RequestParam(value = "uploadImg") MultipartFile[] files,
        @RequestParam("hdId") Long[] hdIds, @RequestParam("toRegId") String[] toRegIds,
        @RequestParam(value = "remark", required = false) String[] remarks,
        @RequestParam(value="latitude")String[] latitudes,
        @RequestParam(value="longitude")String[] longitudes) {
     for (int idx =  0; idx < hdIds.length; idx++)
     {
        //... Same code as in current method
        officerSvc.save(.....)
     }
} 
注意复数形式和[]


我的基本问题是:是否建议更改api以接受ArrayList/Array而不是单个实例,从而提高上载的性能,同时发挥其优点?事实还是虚构?

是的,它将节省在客户端和服务器之间创建连接的时间。 但也不多,大概1-2秒