Closed GoogleCodeExporter closed 9 years ago
ConcurrentMaps generally forbid null so that callers can distinguish between
"key not
present" and "key maps to null value" atomically. This is true of
ConcurrentHashMap,
for example, which MapMaker uses for simple maps.
You're probably best served by a trivial wrapper class along these lines:
class Maybe<T> {
boolean hasValue();
T getValue();
}
Then you can have a MapMaker<K, Maybe<V>>. It should perform as well as an
internal
implementation would at the cost of a more complex interface. You can probably
implement a Map<K, V> wrapper to fix the latter problem.
Original comment by cpov...@google.com
on 13 May 2009 at 6:20
Thanks for the tip.
Original comment by kevin.a....@gmail.com
on 13 May 2009 at 6:25
Original issue reported on code.google.com by
kevin.a....@gmail.com
on 13 May 2009 at 6:00