rocky.madden wrote:A factory that does nothing but create java collections would of course be overkill.
An issue comes up when coding to interfaces rather than implementing classes and using the factory pattern. In this particular case I am coding for java.util.List, rather than java.util.Vector or java.util.ArrayList, and all works well except when it comes to my concrete factory classes. Obviously, the factory provides an implementation of List. What is a graceful way to allow the developer to choose the List implementation? My current handling:
rocky.madden wrote:That doesn't seem to help me. I can't imagine why a factory is appropriate for that.
More elaboration: One of the attributes of the object being created is a collection of objects. It's a SQL parser, it's creating a "SelectClause" object to place the "SelectQuery" object. The SelectClause object has an List of "Column" objects. I suppose it could be implemented as a simple array or a set.