private List<AppUpdate> consolidateLibs(List<AppUpdate> updates) { List<AppUpdate> appList = new ArrayList<AppUpdate>(); AppUpdate libAppUpdate = new AppUpdate(null); for (AppUpdate upList : updates) { if (upList.isAppList()) { appList.add(upList); } else { libAppUpdate.merge(upList); } } if (!libAppUpdate.isEmpty()) appList.add(libAppUpdate); return appList; }