ListenerRegistration
Where a listener is registered: the add/remove pair of one event source on components of type T, for listeners of type L.
Declare one per event source and hold it in a val - a registration with no key is the same registration only when it is the same object, so one built afresh at a call site is a new registration on every pass and re-registers the listener each time. Declaring a different registration moves the listener to it.
Where the pair closes over something that varies between call sites - the name of a bound property, say - a registration cannot be held in a val, and key is what says which registration it is instead: two registrations carrying equal keys are the same registration. Give the key a type of the site's own, since it is compared against the keys of every other registration.
Parameters
what identifies this registration among registrations built at the same site; null where the registration is held in a val and is therefore identified by being that object.