package com.nbusy.app;

import com.google.common.collect.ImmutableList;

/**
 * One-to-one chat.
 */
public final class Chat {
    public final String id; // unique chat id
    public final String peerName; // peer name
    public final String lastMessage; // last message in conversation
    public final String sent; // last message sent date/time
    public final ImmutableList<Message> messages; // list of messages in this chat

    public Chat(String id, String peerName, String lastMessage, String sent) {
        this(id, peerName, lastMessage, sent, ImmutableList.<Message>of());
    }

    public Chat(String id, String peerName, String lastMessage, String sent, ImmutableList<Message> messages) {
        this.id = id;
        this.peerName = peerName;
        this.lastMessage = lastMessage;
        this.sent = sent;
        this.messages = messages;
    }
}

@@ -28,103 +28,325 @@
 ort 
-com.google.common.collect.ImmutableList;%0A%0A/**%0A * One-to-one chat.%0A */%0Apublic final class Chat %7B
+java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * One-to-one chat.%0A */%0Apublic final class Chat %7B%0A    private static final String TAG = ChatDetailFragment.class.getSimpleName();%0A    private final Map%3CString, Integer%3E messageIDtoIndex; // message ID -%3E messages%5Bindex%5D%0A
 %0A   
@@ -582,25 +582,16 @@
 c final 
-Immutable
 List%3CMes
@@ -769,22 +769,21 @@
 nt, 
-Immutable
+new Array
 List
-.
 %3CMes
@@ -787,18 +787,16 @@
 Message%3E
-of
 ());%0A   
@@ -880,17 +880,8 @@
 nt, 
-Immutable
 List
@@ -1058,16 +1058,60 @@
 ssages;%0A
+        messageIDtoIndex = new HashMap%3C%3E();%0A
     %7D%0A%7D%0A

add all the missing structures to Chat