put method

void put(
  1. String tag,
  2. T instance
)

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;
}