public List<Message> getMessage() { List<Message> messagesTemp = new ArrayList<>(); Message m; System.out.println("Message size : " + messages.size()); for (Message message : messages) { m = Message.newBuilder(message).build(); System.out.println("Messages : " + m.getMessage()); messagesTemp.add(m); } messages.clear(); return messagesTemp; }
public void saveMessage(Message message) { Message m = Message.newBuilder(message).build(); messages.add(m); System.out.println("Message added"); }