src/main/java/org/jivesoftware/smack/UserRoster.java
public RosterGroup createGroup(String name) {
        if (!connection.isAuthenticated()) {
            throw new IllegalStateException("Not logged in to server.");
        }
        if (connection.isAnonymous()) {
            throw new IllegalStateException(
                    "Anonymous users can't have a roster.");
        }
        if (groups.containsKey(name)) {
            throw new IllegalArgumentException("Group with name " + name
                    + " alread exists.");
        }

        RosterGroup group = new RosterGroup(name, connection);
        groups.put(name, group);
        return group;
    }
public RosterGroup createGroup(String name) {
        if (!connection.isAuthenticated()) {
            throw new IllegalStateException("Not logged in to server.");
        }
        if (connection.isAnonymous()) {
            throw new IllegalStateException(
                    "Anonymous users can't have a roster.");
        }
        if (groups.containsKey(name)) {
            throw new IllegalArgumentException("Group with name " + name
                    + " alread exists.");
        }

        RosterGroup group = new RosterGroup(name, connection);
        groups.put(name, group);
        return group;
    }
public RosterGroup createGroup ( String name ) { if ( ! connection . isAuthenticated ( ) ) { throw new IllegalStateException ( "Not logged in to server." ) ; } if ( connection . isAnonymous ( ) ) { throw new IllegalStateException ( "Anonymous users can't have a roster." ) ; } if ( groups . containsKey ( name ) ) { throw new IllegalArgumentException ( "Group with name " + name + " alread exists." ) ; } RosterGroup group = new RosterGroup ( name , connection ) ; groups . put ( name , group ) ; return group ; }
Creates a new group.
<p>
<p/>
Note: you must add at least one entry to the group for the group to be
kept after a logout/login. This is due to the way that XMPP stores group
information.

@param name
the name of the group.
@return a new group.
@throws IllegalStateException
if connection is not logged in or logged in anonymously
Creates a new group . <p > <p / > Note : you must add at least one entry to the group for the group to be kept after a logout / login . This is due to the way that XMPP stores group information .