...
Set<object[]> members = new MembershipFinder().addMembershipId(membership1.getUuid()).addMembershipId(membership2.getUuid()).findMembershipsMembers();
Sample call to find immediate groups of a user
Set membershipsOwnersMembers = new MembershipFinder().addSubject(subject).addField(Group.getDefaultList()).assignMembershipType(MembershipType.IMMEDIATE).assignEnabled(true).findMembershipResult().getMembershipsOwnersMembers();
for (Object membershipsOwnersMember : GrouperUtil.nonNull(membershipsOwnersMembers)) {
Group group = (Group)((Object[])membershipsOwnersMember)[1];
System.out.println(group.getName());
}
Options
Java docs: