Code example for Set

Methods: isEmptyremove

0
        return state;
    } 
 
    public void finished(ConnectionState connectionState) {
        incomingQueue.queue(new ConnectionClosed(connectionState.getConnection()));
        connections.remove(connectionState);
        if (stopping) {
            maybeStop(); 
        } 
    } 
 
    public void requestStop() { 
        stopping = true;
        maybeStop(); 
    } 
 
    private void maybeStop() { 
        if (connections.isEmpty()) {
            outgoingQueue.discardQueued();
            incomingQueue.queue(new EndOfStream());
        } 
    } 
}