Closed GoogleCodeExporter closed 9 years ago
The internal Google code base includes a method that caches all values computed
by a
function:
public static <F,T> Function<F,T> memoize(Function<? super F,? extends T> delegate)
With that method, you could simply say
Lists.transform(list, memoize(function));
Original comment by jared.l....@gmail.com
on 13 May 2010 at 1:33
That's true. If you're willing to have all the data go into a second data
structure.. and then you still want to make it look like a List. And no one
needs to
wait for memoize(); all it does is this:
final Map<F, T> map = mapMaker.makeComputingMap(delegate);
return new Function<F, T>() {
public T apply(F from) {
return map.get(from);
}
};
Having two solutions already, I'm closing this.
Original comment by kevinb@google.com
on 13 May 2010 at 8:23
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:10
Original issue reported on code.google.com by
kevinb@google.com
on 23 Apr 2010 at 6:29