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
e8b0c990
Commit
e8b0c990
authored
Apr 04, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix name
parent
220e6d42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt
...ain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt
+3
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
.../commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
+9
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt
View file @
e8b0c990
...
...
@@ -259,16 +259,16 @@ internal class GroupImpl(
override
operator
fun
get
(
id
:
Long
):
Member
{
return
members
.
delegate
.
fi
lteringGe
tOrNull
{
it
.
id
==
id
}
return
members
.
delegate
.
fi
rs
tOrNull
{
it
.
id
==
id
}
?:
throw
NoSuchElementException
(
"member $id not found in group $uin"
)
}
override
fun
contains
(
id
:
Long
):
Boolean
{
return
members
.
delegate
.
fi
lteringGe
tOrNull
{
it
.
id
==
id
}
!=
null
return
members
.
delegate
.
fi
rs
tOrNull
{
it
.
id
==
id
}
!=
null
}
override
fun
getOrNull
(
id
:
Long
):
Member
?
{
return
members
.
delegate
.
fi
lteringGe
tOrNull
{
it
.
id
==
id
}
return
members
.
delegate
.
fi
rs
tOrNull
{
it
.
id
==
id
}
}
@OptIn
(
MiraiExperimentalAPI
::
class
,
LowLevelAPI
::
class
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
View file @
e8b0c990
...
...
@@ -50,7 +50,8 @@ class ContactList<C : Contact>(@MiraiInternalAPI val delegate: LockFreeLinkedLis
return
null
}
override
fun
toString
():
String
=
delegate
.
asSequence
().
joinToString
(
separator
=
", "
,
prefix
=
"ContactList("
,
postfix
=
")"
)
override
fun
toString
():
String
=
delegate
.
asSequence
().
joinToString
(
separator
=
", "
,
prefix
=
"ContactList("
,
postfix
=
")"
)
}
operator
fun
<
C
:
Contact
>
LockFreeLinkedList
<
C
>.
get
(
id
:
Long
):
C
{
...
...
@@ -63,11 +64,17 @@ fun <C : Contact> LockFreeLinkedList<C>.getOrNull(id: Long): C? {
return
null
}
inline
fun
<
C
:
Contact
>
LockFreeLinkedList
<
C
>.
fi
lteringGe
tOrNull
(
filter
:
(
C
)
->
Boolean
):
C
?
{
inline
fun
<
C
:
Contact
>
LockFreeLinkedList
<
C
>.
fi
rs
tOrNull
(
filter
:
(
C
)
->
Boolean
):
C
?
{
forEach
{
if
(
filter
(
it
))
return
it
}
return
null
}
@PlannedRemoval
(
"1.0.0"
)
@Deprecated
(
"use firstOrNull"
,
replaceWith
=
ReplaceWith
(
"firstOrNull(filter)"
),
level
=
DeprecationLevel
.
ERROR
)
inline
fun
<
C
:
Contact
>
LockFreeLinkedList
<
C
>.
filteringGetOrNull
(
filter
:
(
C
)
->
Boolean
):
C
?
{
return
this
.
firstOrNull
(
filter
)
}
/**
* Collect all the elements into a [MutableList] then cast it as a [List]
...
...
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