Stephan Stephan - 23 days ago 6
Java Question

How to workaround this JDK limitation?

I'm looking for a class from the Java Collection Framework that would not allow null elements.

Do you know one?

Answer

Most Queue implementations (with the notable exception of LinkedList) don't accept null.

EnumSet is a special-purpose Set implementation that doesn't allow null values.