Returns the previously cached ImageStream for the given key, if available; if not, calls the given callback to obtain it first. In either case, the key is moved to the "most recently used" position.
The arguments cannot be null. The loader
cannot return null.
Source
ImageStreamCompleter putIfAbsent(Object key, ImageStreamCompleter loader()) { assert(key != null); assert(loader != null); ImageStreamCompleter result = _cache[key]; if (result != null) { // Remove the provider from the list so that we can put it back in below // and thus move it to the end of the list. _cache.remove(key); } else { if (_cache.length == maximumSize && maximumSize > 0) _cache.remove(_cache.keys.first); result = loader(); } if (maximumSize > 0) { assert(_cache.length < maximumSize); _cache[key] = result; } assert(_cache.length <= maximumSize); return result; }