> I was wondering why it was chosen not to derive the interface of 
> FeatureCollection from the general Collection interface in java, as it 
> implements all the same methods.
> 
> 
To answer that question - we did derive from java.util.Collection - however 
when we moved to Java 5 - the language started assuming what it could do with a 
collection. Specific the "for each" loop syntax did not match with out need to 
"close" an iterator after it was no longer used.


We tried some workaround such as:


for( Feature feature : featureCollection ){
 System.out.println( feature.getID() );
}
featureCollection.purge(); // to clean up any open iterators 


But as you can see above the idea was not thread safe.


There are a couple of other approaches out there; I understand hibernate does 
something similar with iterators that need to be closed (it was where we got 
the idea from). Google collections api focuses on providing things that are 
iteratable; but not a java.util.collection.


We are gradually winding things back to be a nice simple "feature results" 
which is what we tried for in GeoTools 2.0.


Jody


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to