public Chat chatWith(EntityBareJid jid) {
        Chat chat = chats.get(jid);
        if (chat == null) {
            synchronized (chats) {
                // Double-checked locking.
                chat = chats.get(jid);
                if (chat != null) {
                    return chat;
                }
                chat = new Chat(connection(), jid);
                chats.put(jid, chat);
            }
        }
        return chat;
    }
public Chat chatWith ( EntityBareJid jid ) { Chat chat = chats . get ( jid ) ; if ( chat == null ) { synchronized ( chats ) { chat = chats . get ( jid ) ; if ( chat != null ) { return chat ; } chat = new Chat ( connection ( ) , jid ) ; chats . put ( jid , chat ) ; } } return chat ; }
Start a new or retrieve the existing chat with <code>jid</code>.

@param jid the XMPP address of the other entity to chat with.
@return the Chat API for the given XMPP address.