public Collection<Group> getPublicSharedGroups() {
        HashSet<String> groupNames;
        if (!provider.isSharingSupported()) {
            groupNames = new HashSet<>();
        } else {
            groupNames = new HashSet<>(provider.getPublicSharedGroupNames());
        }
        return new GroupCollection(groupNames);
    }
Returns an unmodifiable Collection of all public shared groups in the system.

@return an unmodifiable Collection of all shared groups.
xmppserver/src/main/java/org/jivesoftware/openfire/group/GroupManager.java