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
155d883b
Commit
155d883b
authored
Aug 21, 2019
by
liujiahua123123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SynchronizedLinkedListMap
parent
5fd84411
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
156 additions
and
3 deletions
+156
-3
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java
...java/net/mamoe/mirai/utils/config/MiraiConfigSection.java
+1
-3
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiSynchronizedLinkedListMap.java
...oe/mirai/utils/config/MiraiSynchronizedLinkedListMap.java
+155
-0
No files found.
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiConfigSection.java
View file @
155d883b
package
net.mamoe.mirai.utils.config
;
import
org.jetbrains.annotations.Nullable
;
import
java.util.Collections
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.SortedMap
;
public
class
MiraiConfigSection
<
T
>
extends
MiraiSynchronizedL
I
nkedListMap
<
String
,
T
>
{
public
class
MiraiConfigSection
<
T
>
extends
MiraiSynchronizedL
i
nkedListMap
<
String
,
T
>
{
public
MiraiConfigSection
(){
...
...
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiSynchronizedL
I
nkedListMap.java
→
mirai-core/src/main/java/net/mamoe/mirai/utils/config/MiraiSynchronizedL
i
nkedListMap.java
View file @
155d883b
...
...
@@ -6,10 +6,13 @@ import org.jetbrains.annotations.NotNull;
import
org.jetbrains.annotations.Nullable
;
import
java.util.*
;
import
java.util.function.BiConsumer
;
import
java.util.function.BiFunction
;
import
java.util.function.Function
;
public
class
MiraiSynchronizedL
I
nkedListMap
<
K
,
V
>
extends
AbstractMap
<
K
,
V
>
{
public
class
MiraiSynchronizedL
i
nkedListMap
<
K
,
V
>
extends
AbstractMap
<
K
,
V
>
{
public
MiraiSynchronizedL
I
nkedListMap
(){
public
MiraiSynchronizedL
i
nkedListMap
(){
this
.
sortedMap
=
Collections
.
synchronizedMap
(
new
LinkedHashMap
<>());
}
...
...
@@ -88,6 +91,65 @@ public class MiraiSynchronizedLInkedListMap<K,V> extends AbstractMap<K,V> {
return
this
.
sortedMap
.
toString
();
}
@Override
public
V
getOrDefault
(
Object
key
,
V
defaultValue
)
{
return
this
.
sortedMap
.
getOrDefault
(
key
,
defaultValue
);
}
@Override
public
void
forEach
(
BiConsumer
<?
super
K
,
?
super
V
>
action
)
{
this
.
sortedMap
.
forEach
(
action
);
}
@Override
public
boolean
replace
(
K
key
,
V
oldValue
,
V
newValue
)
{
return
this
.
sortedMap
.
replace
(
key
,
oldValue
,
newValue
);
}
@Nullable
@Override
public
V
replace
(
K
key
,
V
value
)
{
return
this
.
sortedMap
.
replace
(
key
,
value
);
}
@Override
public
void
replaceAll
(
BiFunction
<?
super
K
,
?
super
V
,
?
extends
V
>
function
)
{
this
.
sortedMap
.
replaceAll
(
function
);
}
@Override
public
V
compute
(
K
key
,
BiFunction
<?
super
K
,
?
super
V
,
?
extends
V
>
remappingFunction
)
{
return
this
.
sortedMap
.
compute
(
key
,
remappingFunction
);
}
@Override
public
V
computeIfAbsent
(
K
key
,
Function
<?
super
K
,
?
extends
V
>
mappingFunction
)
{
return
this
.
sortedMap
.
computeIfAbsent
(
key
,
mappingFunction
);
}
@Override
public
V
computeIfPresent
(
K
key
,
BiFunction
<?
super
K
,
?
super
V
,
?
extends
V
>
remappingFunction
)
{
return
this
.
sortedMap
.
computeIfPresent
(
key
,
remappingFunction
);
}
@Override
public
int
hashCode
()
{
return
this
.
sortedMap
.
hashCode
();
}
@Nullable
@Override
public
V
putIfAbsent
(
K
key
,
V
value
)
{
return
this
.
sortedMap
.
putIfAbsent
(
key
,
value
);
}
@Override
public
V
merge
(
K
key
,
V
value
,
BiFunction
<?
super
V
,
?
super
V
,
?
extends
V
>
remappingFunction
)
{
return
this
.
sortedMap
.
merge
(
key
,
value
,
remappingFunction
);
}
@Override
public
boolean
equals
(
Object
o
)
{
return
this
.
sortedMap
.
equals
(
o
);
}
}
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