commonMain.love.forte.simbot.common.collection.collections.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simbot-common-collection Show documentation
Show all versions of simbot-common-collection Show documentation
Simple Robot,一个通用的bot风格事件调度框架,以灵活的统一标准来编写bot应用。
/*
* Copyright (c) 2024. ForteScarlet.
*
* Project https://github.com/simple-robot/simpler-robot
* Email [email protected]
*
* This file is part of the Simple Robot Library.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see .
*
*/
package love.forte.simbot.common.collection
/**
* Copy and to immutable collections.
*/
public expect fun Collection.toImmutable(): Collection
/**
* 创建一个优先级并发队列 [PriorityConcurrentQueue] 。
*
* 优先级并发队列允许在多个线程中同时添加、读取和删除元素,
* 并且元素的出队顺序会根据它们的优先级来确定。
*
* @return 返回一个新创建的优先级并发队列。
*/
@ExperimentalSimbotCollectionApi
public expect fun createPriorityConcurrentQueue(): PriorityConcurrentQueue
/**
* 创建一个普通的并发队列 [ConcurrentQueue] 。
*
* 并发队列允许在多个线程中同时添加、读取和删除元素。
*
* @return 返回一个新创建的并发队列。
*/
@ExperimentalSimbotCollectionApi
public expect fun createConcurrentQueue(): ConcurrentQueue