private List<Occupant> getOccupants(MUCRole role) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
        MUCAdmin iq = new MUCAdmin();
        iq.setTo(room);
        iq.setType(IQ.Type.get);
        // Set the specified role. This may request the list of moderators/participants.
        MUCItem item = new MUCItem(role);
        iq.addItem(item);

        MUCAdmin answer = (MUCAdmin) connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
        // Get the list of participants from the server's answer
        List<Occupant> participants = new ArrayList<Occupant>();
        for (MUCItem mucadminItem : answer.getItems()) {
            participants.add(new Occupant(mucadminItem));
        }
        return participants;
    }
private List < Occupant > getOccupants ( MUCRole role ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { MUCAdmin iq = new MUCAdmin ( ) ; iq . setTo ( room ) ; iq . setType ( IQ . Type . get ) ; MUCItem item = new MUCItem ( role ) ; iq . addItem ( item ) ; MUCAdmin answer = ( MUCAdmin ) connection . createStanzaCollectorAndSend ( iq ) . nextResultOrThrow ( ) ; List < Occupant > participants = new ArrayList < Occupant > ( ) ; for ( MUCItem mucadminItem : answer . getItems ( ) ) { participants . add ( new Occupant ( mucadminItem ) ) ; } return participants ; }
Returns a list of <code>Occupant</code> that have the specified room role.

@param role the role of the occupant in the room.
@return a list of <code>Occupant</code> that have the specified room role.
@throws XMPPErrorException if an error occured while performing the request to the server or you
don't have enough privileges to get this information.
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException