I have a scala function which returns a util.Map[String], util.Set[String]
.
def getAcls(): Map[String, Set[String]] = {
((for (groupRole: GroupRoleAccess <- groupRoleAccess;
user <- groupService.getGroup(groupRole.groupId).getUsers;
permissions = roleService.getRole(groupRole.roleId) .getPermissions)
yield user.getUserId -> permissions).groupBy(_._1).map { case (k,v) => (k, v.flatMap(_._2).asJava)})
}
I am simply calling this method on a set of these objects to get a util.Set[util.Map[String], util.Set[String]]
.
var unevaluatedacls = for (aclTemplate <- aclTemplates)
yield aclTemplate.getAcls
When I inspect unevaluatedacls
, I see that it is of the type HashSet
. But its elements are of the type Wrappers$MapWrapper
instead of util.Map
. As a result of this, I am unable to persist this object. I cannot understand this behavior. When I try
var unevaluatedacls = (for (aclTemplate <- aclTemplates)
yield aclTemplate.getAcls).asJava
the unevaluatedacls
also changes to Wrapper$SetWrapper
. Is it because I am somehow trying to convert immutable scala collections to java collections? I know that only mutable scala collections are compatible to be converted to corresponding java collections using JavaConverters