Slackbot
09/21/2023, 6:20 PMVampire
09/21/2023, 8:20 PM.asMap.
But what is so problematic with _container_._names_._associateWith_(_container_::named)?
You could even pack it into an extension function if you prefer:
fun <T> NamedDomainObjectCollection<T>.asLazyMap() = _names_._associateWith_(::named)
and then container._asLazyMap_().Kelvin Chung
09/21/2023, 8:22 PMVampire
09/21/2023, 8:24 PMPhilip W
09/21/2023, 9:07 PMKelvin Chung
09/21/2023, 9:08 PMProvider<Map<String, T>> instead?Vampire
09/22/2023, 2:16 PMMap which wouldn't change.
A live map like Philip means would always have the proper entries live.
So if you get the map now, then add an entry to the container (or even remove one), the map would automatically have (or not have) the according entries.