Fix chat list printing in Java example.
This commit is contained in:
parent
027c78c691
commit
f37f9a78c1
|
@ -248,7 +248,7 @@ public final class Example {
|
||||||
private static void getMainChatList(final int limit) {
|
private static void getMainChatList(final int limit) {
|
||||||
synchronized (mainChatList) {
|
synchronized (mainChatList) {
|
||||||
if (!haveFullMainChatList && limit > mainChatList.size()) {
|
if (!haveFullMainChatList && limit > mainChatList.size()) {
|
||||||
// have enough chats in the chat list or chat list is too small
|
// send GetChats request if there are some unknown chats and have not enough known chats
|
||||||
long offsetOrder = Long.MAX_VALUE;
|
long offsetOrder = Long.MAX_VALUE;
|
||||||
long offsetChatId = 0;
|
long offsetChatId = 0;
|
||||||
if (!mainChatList.isEmpty()) {
|
if (!mainChatList.isEmpty()) {
|
||||||
|
@ -281,11 +281,10 @@ public final class Example {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// have enough chats in the chat list to answer request
|
|
||||||
java.util.Iterator<OrderedChat> iter = mainChatList.iterator();
|
java.util.Iterator<OrderedChat> iter = mainChatList.iterator();
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println("First " + limit + " chat(s) out of " + mainChatList.size() + " known chat(s):");
|
System.out.println("First " + limit + " chat(s) out of " + mainChatList.size() + " known chat(s):");
|
||||||
for (int i = 0; i < limit; i++) {
|
for (int i = 0; i < limit && i < mainChatList.size(); i++) {
|
||||||
long chatId = iter.next().chatId;
|
long chatId = iter.next().chatId;
|
||||||
TdApi.Chat chat = chats.get(chatId);
|
TdApi.Chat chat = chats.get(chatId);
|
||||||
synchronized (chat) {
|
synchronized (chat) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user