I have been running into the limitations of current FeatureCollection
implementations, that were done rather quickly as the last improvement
for GeoTools2.1. Since I did the rather quick work, I am obviously
doomed to learn from it.
To wit: I have set up AbstractResourceCollection and ResourceCollection
interface to isolate the required behavior of close( iterator ) needed
for resource access goodness.
Functionally this acts in the same manner as AbstractFeatureCollection,
all the basic precanned opperations have been recast in terms of:
Iterator e = iterator();
blah blah blah
close( e );
In addition I have found it needed to introduce
ResourceCollection.purge() - which can be used to clean up after an
otherwise innocent collection operations.
Collections.sort( featureCollection );
- purge() is a bit drastic
- close() was worse
- flush() was considered given its previous history in an I/O context
(but outputstream.flush() still leaves file handles usable)
- cleanup() well we did make a mess
- closeIterators() or cleanupIterators() would leave little doubt, at
the expense of a naming scheme
You can also figure out that FeatureCollection ISA ResourceCollection.