Java汇总List数据

list = totallogService.retrieve();
		if (list.size() > 0) {
			totallog = new Totallog();
			int handled = 0;
			int reported = 0;
			int unassigned = 0;
			int untreated = 0;
			for (int i = 0; i < list.size(); i++) {
				handled += list.get(i).getHandled();
				reported += list.get(i).getReported();
				unassigned += list.get(i).getUnassigned();
				untreated += list.get(i).getUntreated();

				totallog.setLastTime(list.get(i).getLastTime());
			}
			totallog.setHandled(handled);
			totallog.setReported(reported);
			totallog.setUnassigned(unassigned);
			totallog.setUntreated(untreated);
			list.add(totallog);
		}

你可能感兴趣的:(java,list,汇总)