-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
4 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.common.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2019-2020 Mamoe Technologies and contributors. | ||
* | ||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. | ||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. | ||
* | ||
* https://github.com/mamoe/mirai/blob/master/LICENSE | ||
*/ | ||
|
||
package net.mamoe.mirai.qqandroid.utils | ||
|
||
// We target JVM and Android only. | ||
internal expect class LinkedList<E>() : List<E>, Queue<E>, Deque<E> | ||
|
||
internal interface Queue<E> : MutableCollection<E> { | ||
override fun add(element: E): Boolean | ||
fun offer(element: E): Boolean | ||
fun remove(): E | ||
fun poll(): E | ||
fun element(): E | ||
fun peek(): E | ||
} | ||
|
||
internal interface Deque<E> : Queue<E> { | ||
fun addFirst(e: E) | ||
fun addLast(e: E) | ||
fun offerFirst(e: E): Boolean | ||
fun offerLast(e: E): Boolean | ||
fun removeFirst(): E | ||
fun removeLast(): E | ||
fun pollFirst(): E | ||
fun pollLast(): E | ||
val first: E | ||
val last: E | ||
fun peekFirst(): E | ||
fun peekLast(): E | ||
fun removeFirstOccurrence(o: E): Boolean | ||
fun removeLastOccurrence(o: E): Boolean | ||
fun push(e: E) | ||
fun pop(): E | ||
fun descendingIterator(): Iterator<E> | ||
} |
17 changes: 17 additions & 0 deletions
17
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* | ||
* * Copyright 2020 Mamoe Technologies and contributors. | ||
* * | ||
* * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. | ||
* * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. | ||
* * | ||
* * https://github.com/mamoe/mirai/blob/master/LICENSE | ||
* | ||
*/ | ||
|
||
package net.mamoe.mirai.qqandroid.utils | ||
|
||
import java.util.LinkedList | ||
|
||
@Suppress("ACTUAL_WITHOUT_EXPECT") | ||
internal actual typealias LinkedList<E> = LinkedList<E> |