I have a Set[Set[String], Set[String]] of java.util.Set type which I want to convert to scala.immutable.Map[String, scala.immutable.Set[String]]. The mapping is like each element of the first set inside the outermost set maps to the second set of the outermost set. I tried a for expression:
for (groupRole <- groupRoleAccess;
user <- groupService.getGroup(groupRole.groupId).getUsers.asScala;
permissions = roleService.getRole(groupRole.roleId).getPermissions.asScala)
yield Map(user, permissions)
where groupRoleAccess is the outermost set,
getUsers gives me the first set inside the outermost set,
getPermissions gives me the second set inside the outermost set
However, what I get is a Set[Map[String, Set[String]]] and of the collection.mutable.Set type. Do I again apply a function to change this Set to the Map I need or is there a better way out?
Set[Set[String], Set[String]]? Also, can you please an example ofdesiredFunction(input example) === desiredOutput? Example:addOne(4) === 5