[rules-dev] drools-api
Greg Barton
greg_barton at yahoo.com
Mon Sep 29 12:00:11 EDT 2008
--- On Mon, 9/29/08, Mark Proctor <mproctor at 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>>
> 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.
More information about the rules-dev
mailing list