Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
aa2805b8
Commit
aa2805b8
authored
May 10, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let ContactList<C> implement Collection<C>
parent
a99a83be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
.../commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
+5
-5
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
View file @
aa2805b8
...
...
@@ -23,17 +23,17 @@ import kotlin.jvm.JvmField
*/
@Suppress
(
"unused"
)
class
ContactList
<
C
:
Contact
>
internal
constructor
(
@JvmField
internal
val
delegate
:
LockFreeLinkedList
<
C
>)
:
Iterable
<
C
>
{
Iterable
<
C
>
,
Collection
<
C
>
{
operator
fun
get
(
id
:
Long
):
C
=
delegate
.
asSequence
().
firstOrNull
{
it
.
id
==
id
}
?:
throw
NoSuchElementException
(
"Contact id $id"
)
fun
getOrNull
(
id
:
Long
):
C
?
=
delegate
.
getOrNull
(
id
)
val
size
:
Int
get
()
=
delegate
.
size
operator
fun
contains
(
element
:
C
):
Boolean
=
delegate
.
contains
(
element
)
override
val
size
:
Int
get
()
=
delegate
.
size
o
verride
o
perator
fun
contains
(
element
:
C
):
Boolean
=
delegate
.
contains
(
element
)
operator
fun
contains
(
id
:
Long
):
Boolean
=
delegate
.
getOrNull
(
id
)
!=
null
fun
containsAll
(
elements
:
Collection
<
C
>):
Boolean
=
elements
.
all
{
contains
(
it
)
}
fun
isEmpty
():
Boolean
=
delegate
.
isEmpty
()
override
fun
containsAll
(
elements
:
Collection
<
C
>):
Boolean
=
elements
.
all
{
contains
(
it
)
}
override
fun
isEmpty
():
Boolean
=
delegate
.
isEmpty
()
override
fun
toString
():
String
=
delegate
.
asSequence
().
joinToString
(
separator
=
", "
,
prefix
=
"ContactList("
,
postfix
=
")"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment