jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: SPI: usage of java.util.Properties in interfaces
Date Fri, 27 Oct 2006 16:12:47 GMT
Julian Reschke wrote:
> Marcel Reutegger schrieb:
>> because we didn't see a need for a Set. a collection is IMO 
>> sufficient. what is the benefit of a Set over a Collection for a client?
> The client can rely on not having duplicates in it,

The client can rely on it anyway because the documentation says so. e.g. even a 
Set would allow a null value in general but getDependencies() will never return 
a collection with a null value. IMO the binding contract is the documentation, 
specifically when dealing with collection classes that are very general.

Using a Set would make sense when passing in a collection of objects and the 
callee doesn't want to accept duplicates.

 > or alternatively,
 > the producer doesn't need to take care not to produce them...

Using a Collection gives the producer the freedom to choose which implementation 
he wants to use. if there are just a couple of element an ArrayList is less 
expensive than a HashSet.


View raw message