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

Thomas Hawtin tackline at tackline.plus.com
Sun Apr 15 22:28:07 EDT 2007

Holger Hoffstätte wrote:
> Taking into consideration the general robustness principle "be
> conservative in what you do, be liberal in what you accept from others",

That's a very dubious principle. It's the sort of thinking which has 
left us with the current state of HTML, for instance. How nasty is that? 
Better to catch bugs as soon as possible, even if it causes a little 
inconvenience to some adversaries.

> coupled with the "principle of least surprise", one could argue just as
> well for returning false from contains(null).

Least surprise would be making nulls work consistently, rather than 
depending upon who wrote the class.

Tom Hawtin

More information about the Concurrency-interest mailing list