From d98c8bd9d1d4f749bd59aa2d3e0905db28c394a6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 10 三月 2021 18:24:19 +0800 Subject: [PATCH] ArrayList实例化优化 --- src/main/java/com/yeshi/buwan/service/imp/ClassService.java | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/ClassService.java b/src/main/java/com/yeshi/buwan/service/imp/ClassService.java index b14e587..740d12e 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/ClassService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/ClassService.java @@ -238,7 +238,7 @@ (page - 1) * pageCount, pageCount, new Serializable[]{resourceWhere, orderby,}), resourceList); } - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); long startTime = System.currentTimeMillis(); @@ -247,7 +247,7 @@ final String orderbyNew = orderby; list = (List<VideoInfo>) videoTypeDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); try { session.setCacheMode(CacheMode.GET); String sql = String.format( @@ -269,7 +269,7 @@ } public List<VideoInfo> getVideoInfoData(List list, List<Long> resourceIdList) { - List<VideoInfo> dataList = new ArrayList<VideoInfo>(); + List<VideoInfo> dataList = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { Object[] obj = (Object[]) list.get(i); VideoInfo info = new VideoInfo(); @@ -283,7 +283,7 @@ info.setCommentCount(obj[7]!=null? Integer.parseInt(obj[7] + ""):0); if (obj.length > 8) { String[] resourceIds = (obj[8] + "").split(","); - List<VideoResource> resourceList = new ArrayList<VideoResource>(); + List<VideoResource> resourceList = new ArrayList<>(); for (String rid : resourceIds) resourceList.add(new VideoResource(rid)); info.setResourceList(resourceList); @@ -356,14 +356,14 @@ if (wheres.startsWith("or")) wheres = wheres.substring(2, wheres.length()); - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); final String wheresNew = wheres; final String yearWhereNew = yearWhere; final String orderbyNew = orderby; list = (List<VideoInfo>) videoTypeDao.excute(new HibernateCallback<List<VideoInfo>>() { public List<VideoInfo> doInHibernate(Session session) throws HibernateException { - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); try { list = session .createSQLQuery( @@ -382,7 +382,7 @@ } private List<VideoInfo> parseVideoListAmin(List list) { - List<VideoInfo> resultList = new ArrayList<VideoInfo>(); + List<VideoInfo> resultList = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { Object[] objs = (Object[]) list.get(i); VideoInfo video = new VideoInfo(); @@ -586,7 +586,7 @@ .excute(new HibernateCallback<List<com.yeshi.buwan.domain.web.VideoTypeAdmin>>() { public List<com.yeshi.buwan.domain.web.VideoTypeAdmin> doInHibernate(Session session) throws HibernateException { - List<com.yeshi.buwan.domain.web.VideoTypeAdmin> hotTypeList = new ArrayList<com.yeshi.buwan.domain.web.VideoTypeAdmin>(); + List<com.yeshi.buwan.domain.web.VideoTypeAdmin> hotTypeList = new ArrayList<>(); try { List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list(); String where = ""; @@ -628,7 +628,7 @@ .createQuery("select vb.detailSystem from SuperVideoType vb where vb.type.id=?") .setParameter(0, vb.getId()).list(); - List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>(); + List<DetailSystemSelect> dssList = new ArrayList<>(); for (DetailSystem ds : detailSystemList) { DetailSystemSelect dss = new DetailSystemSelect(); -- Gitblit v1.8.0