http://mopishv0.blog.163.com/blog/static/5445593220101016102129741/

    private List<String> uploadNoticeOtherFile(HttpServletRequest request,
MultipartFile[] noticeOtherFiles, User user,
ServletContext servletContext) {
List<String> fileList = new ArrayList<String>();
if(noticeOtherFiles != null && noticeOtherFiles.length > 0 && noticeOtherFiles[0].getSize() > 0){
List<FileEntity> fileEntityList = null;
try {
//文件去空
List<MultipartFile> noticeOtherFileList = new ArrayList<MultipartFile>();
for (int i = noticeOtherFiles.length; i > 0; i--) {
MultipartFile noticeOtherFile = noticeOtherFiles[i];
if(noticeOtherFile != null && !noticeOtherFile.isEmpty() && noticeOtherFile.getSize() > 0 && !StringUtils.isBlank(noticeOtherFile.getName())){
noticeOtherFileList.add(noticeOtherFile);
}
} fileEntityList = UploadFileUtils.uploadFiles(request, noticeOtherFileList.toArray(new MultipartFile[noticeOtherFileList.size()]), NoticeDictMailAttachTpl.BUSINESS_NAME, user.getId());
} catch (FileUploadException e) {
logger.error(e.getMessage());
e.printStackTrace();
}
if(fileEntityList != null && fileEntityList.size() > 0){
for(FileEntity fileEntity : fileEntityList)
fileList.add(fileEntity.getFilePath());
}
}
return fileList;
}

关于<T> T[] toArray(T[] a) 方法的更多相关文章

  1. 集合转数组的toArray()和toArray(T[] a)方法

    参考:集合转数组的toArray()和toArray(T[] a)方法 1.ArrayList的toArray ArrayList提供了一个将List转为数组的一个非常方便的方法toArray.toA ...

  2. toString() toArray() 等to方法

    1.toString()方法toString()方法是把对象转成String类型的 println(Ojbect object)的方法他会自动调用被打印对象的toString方法,所以其实你的Syst ...

  3. List中toArray()的使用方法

    当我们需要把一个链表中的元素放入数组时,jdk给我们提供了一种方法,也即运用toArray(),方法的使用如下: public class Test { public static void main ...

  4. AbstractCollection类中的 T[] toArray(T[] a)方法源码解读

    一.源码解读 @SuppressWarnings("unchecked") public <T> T[] toArray(T[] a) { //size为集合的大小 i ...

  5. 为什么 Java ArrayList.toArray(T[]) 方法的参数类型是 T 而不是 E ?

    前两天给同事做 code review,感觉自己对 Java 的 Generics 掌握得不够好,便拿出 <Effective Java>1 这本书再看看相关的章节.在 Item 24:E ...

  6. 【转载】 C#中ArrayList使用ToArray方法转换为数组

    在C#的编程开发中,ArrayList集合是一个常用的非泛型类集合,可以使用ArrayList中的ToArray方法将ArrayList集合对象转换为数组,ToArray方法有2个重载形式,其一为vi ...

  7. code first提示已有打开的与此 Command 相关联的 DataReader,必须首先将它关闭解决方法

    使用codefirst查询当然是必不可少的,但有时不小心可能很简单的查询也会导致异常. 下面用codefirst做个示例简单演示下异常发生的场景: var attendlist = db.Databa ...

  8. Entity Framework 基于方法的查询语法

      实体框架(Entity Framework )是 ADO.NET 中的一套支持开发面向数据的软件应用程序的技术. LINQ to Entities 提供语言集成查询 (LINQ) 支持,它允许开发 ...

  9. zepto源码--核心方法(类数组相关)--学习笔记

    从这篇起,在没有介绍到各类插件之前,后面将陆续介绍zepto对外暴露的核心方法.即$.fn={}里面的所有方法的介绍.会配合zepto的API进行介绍. 其实前面已经介绍了几个,如width,heig ...

随机推荐

  1. 从零上手Python关键代码

    来源 https://www.kesci.com/home/project/59e4331c4663f7655c499bc3

  2. OCX ACTIVEX程序打包个人精典案例(OCX)

  3. centos 7部署openvpn easy-rsa 3.0部署方法

    yum install openvpn easy-rsa openssl-devel mkdir -p /etc/openvpn/easy-rsa/cp -p /usr/share/doc/easy- ...

  4. mysql获取表中数据行数

    获取单个表的行数 使用count(*)或者count(1) SELECT count(1) AS count FROM table_name; 执行结果 获取两个表的行数 使用union组合每个sel ...

  5. Android学习之基础知识十一 —运用手机多媒体

    一.使用通知(Notification) 通知(Notification)是Android系统中比较有特色的一个功能,当某个应用程序希望向用户发出一些提示信息,而该应用程序又不在前台运行时,就可以借助 ...

  6. Android学习之基础知识四-Activity活动5讲(Activity的生命周期)

    一.返回栈 1.Android是通过任务(Task)来管理活动,一个任务就是一个返回栈内所有活动的集合. 2.返回栈是一个后进先出的数据结构,每启动一个新的活动,该活动就会覆盖原来的活动,位于栈顶位置 ...

  7. odoo学习之弹框显示

    按条件隐藏: <xpath expr="//group[1]" position="attributes"> <attribute name= ...

  8. Github.Git

    Github介绍:http://www.yangzhiping.com/tech/github.html Git:http://res.crossincode.com/wechat/git.html

  9. python winpdb远程调试

    1.使用rpdb2.start_embedded_debugger ,注意要将参数fAllowRemote 设置为True 2.winpdb前端GUI使用python2 3.rpdb兼容python2 ...

  10. 【iOS】build diff: /../Podfile.lock: No such file or directory

    Github 上下载的开源项目,在 Xcode 打开运行后报了错,如图所示: 解决方法: 在工程设置中的 Build Phases 下删除 Check Pods Manifest.lock 及 Cop ...