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

Szabolcs Ferenczi szabolcs.ferenczi at gmail.com
Sun Apr 15 17:06:54 EDT 2007

On 15/04/07, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:
> Where is the null inserted in your test?

It is not inserted but queried, see "q.contains(null)"

The documentation for method "public boolean contains(Object o)" says:

NullPointerException - if the specified element is null and this
collection does not permit null elements (optional)"

It seems LinkedBlockingQueue does not permit null elements, does it?

Best Regards,

More information about the Concurrency-interest mailing list