/** * Parses a {@link Set} of group operations from an Object that is expected to be a {@link List} of {@link Map}. * * @param attributes An Map that contains an object that is the representation of List of group operations. * @return A {@link Set} of GroupOperation or {@link Collections#emptySet()}. */ @SuppressWarnings("unchecked") public static Set<GroupOperation> getOperations(Map<String, Object> attributes) { if (!hasOperations(attributes)) { return Collections.emptySet(); } List<Object> operations = Utilities.getCasted(attributes, OPERATIONS, List.class); if (operations == null) { return Collections.emptySet(); } // Return a list of distinct, non-null, GroupOperations return operations.stream().map(GroupOperation::makeOperation).filter(Objects::nonNull).collect(Collectors.toSet()); }