that’s what I came up with, most probably not the ...
# announcements
n
that’s what I came up with, most probably not the best solution yet:
Copy code
override fun findAllConnections(): MultiValueMap<String, Connection<*>> {
        val connections = connectionRepository.findAllByUserIdOrderByProviderIdDescRankDesc(userId)
        val providers = connections.map(mapConnectionModel)
                .map { connectionFactoryLocator.getConnectionFactory(it.providerId).createConnection(it) }
                .groupBy { it.key.providerId }.toSortedMap()

        val registeredProviders = connectionFactoryLocator.registeredProviderIds()
        return registeredProviders.filter { rp -> providers.keys.contains(rp) }
                .associateBy({ it }, { emptyList<Connection<*>>() }).plus(providers)
                .let { LinkedMultiValueMap<String, Connection<*>>(it) }
    }