From f25a02a94ddd84389b288807cb4fa7b2a8056670 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 14 Oct 2017 21:03:47 +0200 Subject: [PATCH] Please cherry-pick: - simplified for() loop, no need for extra iteration + next instance as a simple double-dot (:) does the same on a List MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../JobsBusinessDataWebRequestBean.java | 9 +++---- .../JobsBranchOfficeWebRequestBean.java | 9 +++---- .../JobsDepartmentWebRequestBean.java | 9 +++---- .../JobsCompanyEmployeeWebRequestBean.java | 9 +++---- .../JobsOpeningTimeWebRequestBean.java | 9 +++---- .../country/JobsCountryWebRequestBean.java | 9 +++---- .../JobsMobileProviderWebRequestBean.java | 9 +++---- .../beans/phone/JobsPhoneWebRequestBean.java | 27 +++++++------------ .../beans/user/JobsUserWebRequestBean.java | 11 +++----- .../JobsUserActivityWebRequestBean.java | 4 +-- web/WEB-INF/links.jsf.taglib.xml | 6 ++--- web/WEB-INF/widgets.jsf.taglib.xml | 4 +-- 12 files changed, 41 insertions(+), 74 deletions(-) diff --git a/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBusinessDataWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBusinessDataWebRequestBean.java index c443c278..0b09570b 100644 --- a/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBusinessDataWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBusinessDataWebRequestBean.java @@ -375,15 +375,12 @@ public class JobsBusinessDataWebRequestBean extends BaseJobsBean implements Jobs // Is cache there? if (!this.basicDataCache.iterator().hasNext()) { // Get whole list - final List list = this.businessDataBean.allCompanyBasicData(); + final List basicDatas = this.businessDataBean.allCompanyBasicData(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final BusinessBasicData next = iterator.next(); - + for (final BusinessBasicData basicData : basicDatas) { // Add it to cache - this.basicDataCache.put(next.getBasicDataId(), next); + this.basicDataCache.put(basicData.getBasicDataId(), basicData); } } diff --git a/src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsBranchOfficeWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsBranchOfficeWebRequestBean.java index be301316..8b8aebd7 100644 --- a/src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsBranchOfficeWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/branchoffice/JobsBranchOfficeWebRequestBean.java @@ -146,15 +146,12 @@ public class JobsBranchOfficeWebRequestBean extends BaseJobsBean implements Jobs // Is cache there? if (!this.branchOfficeCache.iterator().hasNext()) { // Get whole list - final List list = this.branchOfficeBean.allBranchOffices(); + final List branchOffices = this.branchOfficeBean.allBranchOffices(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final BranchOffice next = iterator.next(); - + for (final BranchOffice branchOffice : branchOffices) { // Add it to cache - this.branchOfficeCache.put(next.getBranchId(), next); + this.branchOfficeCache.put(branchOffice.getBranchId(), branchOffice); } } diff --git a/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java index 2676e98c..422f0c5d 100644 --- a/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java @@ -146,15 +146,12 @@ public class JobsDepartmentWebRequestBean extends BaseJobsBean implements JobsDe // Is cache there? if (!this.departmentCache.iterator().hasNext()) { // Get whole list - final List list = this.departmentBean.allDepartments(); + final List departments = this.departmentBean.allDepartments(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final Department next = iterator.next(); - + for (final Department department : departments) { // Add it to cache - this.departmentCache.put(next.getDepartmentId(), next); + this.departmentCache.put(department.getDepartmentId(), department); } } diff --git a/src/java/org/mxchange/jjobs/beans/business/employee/JobsCompanyEmployeeWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/employee/JobsCompanyEmployeeWebRequestBean.java index 43ad415a..bfb58e52 100644 --- a/src/java/org/mxchange/jjobs/beans/business/employee/JobsCompanyEmployeeWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/employee/JobsCompanyEmployeeWebRequestBean.java @@ -146,15 +146,12 @@ public class JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl // Is cache there? if (!this.employeeCache.iterator().hasNext()) { // Get whole list - final List list = this.employeeBean.allCompanyEmployees(); + final List employees = this.employeeBean.allCompanyEmployees(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final Employee next = iterator.next(); - + for (final Employee employee : employees) { // Add it to cache - this.employeeCache.put(next.getEmployeeId(), next); + this.employeeCache.put(employee.getEmployeeId(), employee); } } diff --git a/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java index ca350fa7..c0fae99d 100644 --- a/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java @@ -142,15 +142,12 @@ public class JobsOpeningTimeWebRequestBean extends BaseJobsBean implements JobsO // Is cache there? if (!this.openingTimesCache.iterator().hasNext()) { // Get whole list - final List list = this.openingTimesBean.allOpeningTimes(); + final List openingTimes = this.openingTimesBean.allOpeningTimes(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final OpeningTime next = iterator.next(); - + for (final OpeningTime openingTime : openingTimes) { // Add it to cache - this.openingTimesCache.put(next.getOpeningId(), next); + this.openingTimesCache.put(openingTime.getOpeningId(), openingTime); } } diff --git a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java index 94a27c29..112a1b62 100644 --- a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java @@ -124,15 +124,12 @@ public class JobsCountryWebRequestBean extends BaseJobsBean implements JobsCount // Is cache there? if (!this.countryCache.iterator().hasNext()) { // Get whole list - final List list = this.countryBean.allCountries(); + final List countries = this.countryBean.allCountries(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final Country next = iterator.next(); - + for (final Country country : countries) { // Add it to cache - this.countryCache.put(next.getCountryId(), next); + this.countryCache.put(country.getCountryId(), country); } } } diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java index 8c796220..5975a5ac 100644 --- a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java @@ -144,15 +144,12 @@ public class JobsMobileProviderWebRequestBean extends BaseJobsBean implements Jo // Is cache there? if (!this.mobileProviderCache.iterator().hasNext()) { // Get whole list - final List list = this.mobileProviderBean.allMobileProviders(); + final List mobileProviders = this.mobileProviderBean.allMobileProviders(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final MobileProvider next = iterator.next(); - + for (final MobileProvider mobileProvider : mobileProviders) { // Add it to cache - this.mobileProviderCache.put(next.getProviderId(), next); + this.mobileProviderCache.put(mobileProvider.getProviderId(), mobileProvider); } } diff --git a/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java index ec318840..14039ba9 100644 --- a/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java @@ -554,45 +554,36 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe // Is cache there? if (!this.faxNumberCache.iterator().hasNext()) { // Get whole list - final List list = this.phoneBean.allFaxNumbers(); + final List faxNumbers = this.phoneBean.allFaxNumbers(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final DialableFaxNumber next = iterator.next(); - + for (final DialableFaxNumber faxNumber : faxNumbers) { // Add it to cache - this.faxNumberCache.put(next.getPhoneId(), next); + this.faxNumberCache.put(faxNumber.getPhoneId(), faxNumber); } } // Is cache there? if (!this.landLineNumberCache.iterator().hasNext()) { // Get whole list - final List list = this.phoneBean.allLandLineNumbers(); + final List lineNumbers = this.phoneBean.allLandLineNumbers(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final DialableLandLineNumber next = iterator.next(); - + for (final DialableLandLineNumber lineNumber : lineNumbers) { // Add it to cache - this.landLineNumberCache.put(next.getPhoneId(), next); + this.landLineNumberCache.put(lineNumber.getPhoneId(), lineNumber); } } // Is cache there? if (!this.mobileNumberCache.iterator().hasNext()) { // Get whole list - final List list = this.phoneBean.allMobileNumbers(); + final List mobileNumbers = this.phoneBean.allMobileNumbers(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final DialableMobileNumber next = iterator.next(); - + for (final DialableMobileNumber mobileNumber : mobileNumbers) { // Add it to cache - this.mobileNumberCache.put(next.getPhoneId(), next); + this.mobileNumberCache.put(mobileNumber.getPhoneId(), mobileNumber); } } } diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java index e9d86a42..2a3ee65e 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java @@ -828,16 +828,13 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR // Is cache there? if (!this.userCache.iterator().hasNext()) { // Get whole list - final List list = this.userBean.allUsers(); + final List users = this.userBean.allUsers(); // Add all - for (final Iterator iterator = list.iterator(); iterator.hasNext();) { - // Get next element - final User next = iterator.next(); - + for (final User user : users) { // Add it to cache - this.userCache.put(next.getUserId(), next); - this.userNameCache.put(next.getUserId(), next.getUserName()); + this.userCache.put(user.getUserId(), user); + this.userNameCache.put(user.getUserId(), user.getUserName()); } } diff --git a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebRequestBean.java index 3beb2c04..a5d6e377 100644 --- a/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/activity/JobsUserActivityWebRequestBean.java @@ -545,10 +545,10 @@ public class JobsUserActivityWebRequestBean extends BaseJobsBean implements Jobs @PostConstruct public void init () { // Get whole list - final List list = this.userActivityBean.fetchAllUserActivityLog(); + final List userActivities = this.userActivityBean.fetchAllUserActivityLog(); // Put all in map, per-user - for (final LogableUserActivity userActivity : list) { + for (final LogableUserActivity userActivity : userActivities) { // Is the list there? if (!this.userActivityCache.containsKey(userActivity.getActivityUser())) { // Init list diff --git a/web/WEB-INF/links.jsf.taglib.xml b/web/WEB-INF/links.jsf.taglib.xml index a0841d5a..d07704b7 100644 --- a/web/WEB-INF/links.jsf.taglib.xml +++ b/web/WEB-INF/links.jsf.taglib.xml @@ -55,7 +55,7 @@ along with this program. If not, see . renderShowLink - Whether this tag is used to show mobile data (default true). + Whether this tag is used to show fax data (default true). false java.lang.Boolean @@ -84,7 +84,7 @@ along with this program. If not, see . renderShowLink - Whether this tag is used to show mobile data (default true). + Whether this tag is used to show land-line data (default true). false java.lang.Boolean @@ -136,7 +136,7 @@ along with this program. If not, see . renderShowLink - Whether this tag is used to show mobile data (default true). + Whether this tag is used to show mobile provider data (default true). false java.lang.Boolean diff --git a/web/WEB-INF/widgets.jsf.taglib.xml b/web/WEB-INF/widgets.jsf.taglib.xml index 8fa3bebe..c8b9fb57 100644 --- a/web/WEB-INF/widgets.jsf.taglib.xml +++ b/web/WEB-INF/widgets.jsf.taglib.xml @@ -193,7 +193,7 @@ along with this program. If not, see . resources/tags/admin/panel_grids/fax/admin_fax_data.tpl renderShowLink - Whether this tag is used to show mobile data (default true). + Whether this tag is used to show fax data (default true). false java.lang.Boolean @@ -228,7 +228,7 @@ along with this program. If not, see . resources/tags/admin/panel_grids/landline/admin_landline_data.tpl renderShowLink - Whether this tag is used to show mobile data (default true). + Whether this tag is used to show land-line data (default true). false java.lang.Boolean -- 2.39.5