code: private static Set<Role> distinctRoles(final Iterable<Assignment> assignments) {
          Set<Role> roles = new HashSet<>();
          for (Assignment assignment : assignments) {
              roles.add(assignment.getRole());
          }
          return roles;
      }
docs: ------------------------------------------------------ helper methods