null value in map not allowed?

599 views
Skip to first unread message

aweber1nj

unread,
Jan 25, 2011, 11:07:18 AM1/25/11
to Hazelcast
Forgive me if it's somehow my implementation, but I get a
NullPointerException if I attempt to add a null value to a map (with a
valid, non-null key).

I don't think this is a general restriction of ConcurrentMap, but it
IS a limitation of a ConcurrentHashMap.

So maybe just a comment to add this in the documentation of Hazelcast
Maps if it is not there already? (I may have overlooked it, and if so
I apologize in advance for taking-up space in peoples' mailboxes.)

Thanks,
AJ

Talip Ozturk

unread,
Jan 25, 2011, 11:21:08 AM1/25/11
to haze...@googlegroups.com
Agreed. It is not impossible to support NULL values but for now it is not.

http://twitter.com/oztalip

> --
> You received this message because you are subscribed to the Google Groups "Hazelcast" group.
> To post to this group, send email to haze...@googlegroups.com.
> To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
>
>

Vladimir Dolzhenko

unread,
Jan 25, 2011, 11:49:36 AM1/25/11
to Hazelcast
according to contract of java.util.Map :
http://download.oracle.com/javase/6/docs/api/java/util/Map.html#put(K,
V)

NullPointerException - if the specified key or value is null and this
map does not permit null keys or values

I think it's enough to add to documentation that map doesn't permit
nulls (as Hashtable, ConcurrentHashMap etc do)
Reply all
Reply to author
Forward
0 new messages