Hi,
While browsing the FeatureCollection API, I saw the following:
FeatureCollection defines the Iterator<F>iterator() method, which MAY
seem to clients as if this interface is a sub-interface of
java.lang.Iterable<F>. If it were, it would be possible to use every
FeatureCollection with the Java 5 enhanced for loop (aka for-each
loop).
java.lang.Iterable is available since Java 5.
Instead of writing:
Iterator<Feature> i = fc.iterator();
while(i.hasNext()) {
Feture f = i.next();
// to sg with f
}
one could simply write:
for(Feature f:fc) {
// do sg with f
}
It produces cleaner code and it would make the API more simpler to use
for inexperienced users.
So the FeatureCollection interface should be:
public interface FeatureCollection<T extends FeatureType, F extends
Feature> extends Iterable<F> {
// API methods containing Iterator<F> iterator()
}
Thanks,
Balint
--
Persics Balint
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel