com.github.stormbit.sdk.longpoll.Queue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vk-bot-sdk-kotlin Show documentation
Show all versions of vk-bot-sdk-kotlin Show documentation
The Kotlin library for working with VK api
package com.github.stormbit.sdk.longpoll
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import java.util.concurrent.CopyOnWriteArrayList
/**
* Created by Storm-bit
*
* Queue of updates
*/
class Queue {
/**
* List of updates that we need to handle
*/
@Volatile
var updatesUser = CopyOnWriteArrayList()
@Volatile
var updatesGroup = CopyOnWriteArrayList()
/**
* We add all of updates from longpoll server
* to queue
*
* @param elements Array of updates
*/
fun putAll(elements: JsonArray) {
elements.forEach {
if (it is JsonArray) {
updatesUser.add(it)
} else if (it is JsonObject) {
updatesGroup.add(it)
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy