Closed GoogleCodeExporter closed 9 years ago
It's hard to choose for the user whether strong, weak, or soft references
should be
used, etc., so it would be best for this method to accept a MapMaker which has
been
configured appropriately.
Then the entire implementation of the method boils down to
public static <F, T> Function<F, T> memoize(
Function<F, T> delegate, MapMaker mapMaker) {
final Map<F, T> map = mapMaker.makeComputingMap(delegate);
return new Function<F, T>() {
public T apply(F from) {
return map.get(from);
}
};
}
Is it really worthwhile?
Original comment by kevin...@gmail.com
on 12 Aug 2009 at 5:54
Ah, thanks for pointing out the simpler solution!
That is the kind of method I'd like to have available in most all of my
projects, so
I'd still like to see it in there. But, there are ways I can do that without
insisting on having questionably worthwhile methods in the GCL :).
Original comment by cresw...@gmail.com
on 13 Aug 2009 at 1:18
Original comment by kev...@google.com
on 10 Sep 2009 at 5:16
Original issue reported on code.google.com by
cresw...@gmail.com
on 11 Jun 2009 at 10:03Attachments: