Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0002943Openbravo ERPZ. Otherspublic2008-04-28 22:372008-06-12 09:43
user71 
user71 
normalminoralways
closedfixed 
5
 
2.40alpha-r2 
No
Core
No
0002943: Code-Cleanup: explicit enumeration -> enhanced for-loops
A lot of code uses explicit Enumerations to iterate of i.e. the elements of a Vector. This could be converted to enhanced for-loops as they are shorter and easier to read.

Example for iterating over String stored in a vector:

Instead of:
for (Enumeration<String> e =
   report.xmlDocument.
   xmlTemplate.configuration.hashtable.vecKeys.
   elements();e.hasMoreElements() ;) {
   String id = e.nextElement();

Use:
for (String id :
   report.xmlDocument.
   xmlTemplate.configuration.hashtable.vecKeys) {

The enhanced-for loops are functionwise identical but a lot shorter.
No tags attached.
Issue History

Notes
(0006532)
user71   
2005-06-01 00:00   
(edited on: 2008-06-12 09:43)
This bug was originally reported in SourceForge bug tracker and then migrated to Mantis.

You can see the original bug report in:
https://sourceforge.net/support/tracker.php?aid=1953658 [^]
(0003645)
user71   
2008-04-28 22:46   
(edited on: 2008-06-12 09:26)
Logged In: YES
user_id=418007
Originator: YES

In revision r3876 at lot of the explicit Enumeration usage is converted for ehanced for-loops.
The remaining ones iterate of untyped or <Object> Collections and are not converted.