[concurrency-interest] LinkedBlockingQueue does not throwNullPointerException for the method call contains

Holger Hoffstätte holger at wizards.de
Sun Apr 15 21:11:39 EDT 2007

Szabolcs Ferenczi wrote:
> Well, in this case threading does not really plays role. In this case
> the data structure does not allow for null and if query is about a
> null item, it should result in the same behavior as when the null item
> is attempted to be inserted --- exception.

Taking into consideration the general robustness principle "be
conservative in what you do, be liberal in what you accept from others",
coupled with the "principle of least surprise", one could argue just as
well for returning false from contains(null).


More information about the Concurrency-interest mailing list