put method
Adds instance
for a given tag
, overriding old value if exists.
Implementation
void put(String tag, T instance) {
if (taggedSingletons.containsKey(tag)) {
// clear old instance
Closable.closeWith(taggedSingletons[tag]);
}
taggedSingletons[tag] = instance;
}