Closed GoogleCodeExporter closed 9 years ago
You could use ForwardingMap with the ComputingMap as the delegate.
Original comment by boppenh...@google.com
on 31 Dec 2010 at 6:27
How will using ForwardingMap result in sorted keys?
Original comment by cowwoc...@gmail.com
on 1 Jan 2011 at 3:36
You would need override the appropriate method(s) of ForwardingMap.
Original comment by boppenh...@google.com
on 1 Jan 2011 at 9:30
Sorry, you're going to have to give me a bit more guidance here. Are you
proposing the following?
1. The ForwardingMap should maintain references to a TreeMap and a ComputingMap.
2. Anytime the user requests a value, the TreeMap is consulted first. If it is
missing the key, the ComputingMap is used to generate it.
3. Anytime a key is computed, it is added into the TreeMap.
4. iterator() iterates over the TreeMap (ignoring the ComputingMap)
So far so good, but then how do I get expiring keys to work?
Original comment by cowwoc...@gmail.com
on 1 Jan 2011 at 9:09
This was my mistake, I forgot that entrySet and keySet return mutable views and
not immutable snapshots. My proposed solution is probably not feasible. If I
think of something better, I'll post again.
Original comment by boppenh...@google.com
on 1 Jan 2011 at 10:20
I'm afraid that a sorted version of our computing map would be a *very* large
effort and require extreme duplication of code from MapMaker, and I don't
expect this would ever be a priority. I agree with Ben Manes's advice on SO.
Original comment by kevinb@google.com
on 12 Jan 2011 at 9:37
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
cowwoc...@gmail.com
on 24 Dec 2010 at 5:18