Greg Barton wrote:
--- On Mon, 9/29/08, Mark Proctor <mproctor@codehaus.org> wrote:

  
Another decision we made is that we always return a generic
collection for things now, instead of arrays or lists. In general a
Collection is easier for the end user to work with, and it has toArray
methods on it anyway. We didn't use list, as list implies ordered
semantics. So whether it's kbuilder.KnowledgePackages() or
kpackage.getRules() or kpackage.getProcesses() it's always returning a
Collection<Class>. 
    

Will the Class be constrained?  i.e. Collection<Class<? extends Foo>>
  
We can't extend for user objects, as we don't know the class of the user objects, but it will be for when we know the type - like FactHandle etc.
  
I'm open to other ideas, if people think this can be improved.
I did think about returning just Iterable, to make it even more
generic, but figured that people would want the size./isEmpty methods, 
we'll have to make the other mutating methods throw an exception if 
someone tries to use them.
    

Collection is best.  Wrap in Collections.unmodifiableCollection() if necessary.


      
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev