Closed GoogleCodeExporter closed 9 years ago
Our attitude toward this so far has been that it crosses the line toward
overloading
the builders with too much functionality. We don't want the builders to become
poor-
man's collections. I think it's reasonable to have to do what you're doing
currently
... or the admittedly odd
ImmutableMap.copyOf(Maps.filterKeys(
map, Predicates.not(Predicates.is(key))))
I'm not closing this yet, though.
Original comment by kevin...@gmail.com
on 27 Oct 2009 at 10:22
Original comment by kevin...@gmail.com
on 5 Nov 2009 at 1:07
OK, I have a use case for this. I have a CopyOnWriteMap class that internally
keeps an effectively immutable
(volatile) map reference. When performing a mutating operation it takes a lock,
then copies the map, modifies it,
writes back the modified reference and then releases the lock. This works great
for very fast read-mostly
modestly sized caches.
I'd like to be able to use ImmutableMap (and ImmutableSortedMap) as the
internal storage for these, but without
the Builder supporting mutating methods I need two copies per mutator to
achieve this.
Original comment by jed.wesl...@gmail.com
on 18 Nov 2009 at 3:44
Original issue reported on code.google.com by
hartford...@gmail.com
on 27 Oct 2009 at 10:12