A utility class for building memoized functions. Initially an empty
(mutable) Map, the first call to apply with a particular key uses the
function argument to produce a value and store it in the map before
returning it. Subsequent re-use of this key will return the stored value.
Note that the underlying data structure is a
scala.collection.mutable.HashMap, which may not be thread-safe.
A utility class for building memoized functions. Initially an empty (mutable) Map, the first call to
apply
with a particular key uses thefunction
argument to produce a value and store it in the map before returning it. Subsequent re-use of this key will return the stored value.Note that the underlying data structure is a scala.collection.mutable.HashMap, which may not be thread-safe.
Created by gonztobi on 2/25/14.