-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
6
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
It would be very convenient to be able to have multiple nested foreach loops into one foreach loop by adding as many ":" as required.
JUSTIFICATION :
It's necessary to avoid wasting code space and the code will be very much like reading a sentence.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
this would require enhancing the current foreach loop in the following manner:
for(City city : Array<Country> countries : Array<Continent> continents : Array<planet> planets) {
System.out.println("Here's a list of all the cities in the solar system: " + city.getName());
}
CUSTOMER SUBMITTED WORKAROUND :
use multiple for each loops; for example:
for(Planet planet : planets) {
for(Continent continent : planet) {
for(Country country : continent) {
for(City city : country) {
System.out.println("Here's a list of all the cities in the solar system: " + city.getName());
}
It would be very convenient to be able to have multiple nested foreach loops into one foreach loop by adding as many ":" as required.
JUSTIFICATION :
It's necessary to avoid wasting code space and the code will be very much like reading a sentence.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
this would require enhancing the current foreach loop in the following manner:
for(City city : Array<Country> countries : Array<Continent> continents : Array<planet> planets) {
System.out.println("Here's a list of all the cities in the solar system: " + city.getName());
}
CUSTOMER SUBMITTED WORKAROUND :
use multiple for each loops; for example:
for(Planet planet : planets) {
for(Continent continent : planet) {
for(Country country : continent) {
for(City city : country) {
System.out.println("Here's a list of all the cities in the solar system: " + city.getName());
}
- relates to
-
JDK-6402294 Enhance the new for loop to loop over 1 or more collections
-
- Closed
-