[nem-pl] troche javizacji do csharpizacji ?
Lukasz Kaiser
kaiser at tenet.pl
Thu Feb 5 14:37:36 CET 2004
Hej.
Wyszla Java 1.5 beta z genericsami i innymi cukierkami i pomyslalem, ze
moze chcemy tez jakies cukierki. Jednym z mozliwych cukierkow byloby
wzbogacenie makra "for" o obsluge iteratorow, w.g. opisu:
Enhanced for loop
The Iterator class is used heavily by the Collections API. It provides the
mechanism to navigate sequentially through a Collection. The new enhanced for
loop can replace the iterator when simply traversing through a Collection as
follows. The compiler generates the looping code necessary and with generic
types no additional casting is required.
Before
ArrayList<Integer> list = new ArrayList<Integer>();
for (Iterator i = list.iterator(); i.hasNext();) {
Integer value=(Integer)i.next();
}
After
ArrayList<Integer> list = new ArrayList<Integer>();
for (Integer i : list) { ... }
Co o tym myslicie ? Kamil - czy to byloby proste ?
- lk
More information about the devel-pl
mailing list