Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
ConcurrentSortedLinkedList
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
saad.aswad
ConcurrentSortedLinkedList
Commits
ef78506d
Commit
ef78506d
authored
Nov 10, 2025
by
saad.aswad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Counters for contain and removing
parent
d8f16659
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
17 deletions
+42
-17
workspace.xml
.idea/workspace.xml
+13
-16
SortList.java
src/main/java/SortList.java
+11
-0
SyncListTest.java
src/test/java/SyncListTest.java
+18
-1
No files found.
.idea/workspace.xml
View file @
ef78506d
...
...
@@ -6,10 +6,7 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"3f4b2924-17d7-4794-bacf-d51c4f0be8bb"
name=
"Changes"
comment=
"List length, sorting in Adding implementations."
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/main/java/LockList.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/main/java/LockList.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/main/java/RWLockList.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/main/java/RWLockList.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/main/java/SortList.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/main/java/SortList.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/main/java/SyncList.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/main/java/SyncList.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/test/java/SyncListTest.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/test/java/SyncListTest.java"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
@@ -46,20 +43,20 @@
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
</component>
<component
name=
"PropertiesComponent"
>
<![CDATA[
{
"keyToString"
: {
"ASKED_ADD_EXTERNAL_FILES": "true"
,
"JUnit.SyncListTest.testRun.executor": "Run"
,
"RunOnceActivity.OpenProjectViewOnStart": "true"
,
"RunOnceActivity.ShowReadmeOnStart": "true"
,
"SHARE_PROJECT_CONFIGURATION_FILES": "true"
,
"git-widget-placeholder": "task2"
,
"kotlin-language-version-configured": "true"
,
"project.structure.last.edited": "Modules"
,
"project.structure.proportion": "0.0"
,
"project.structure.side.proportion": "0.0"
<component
name=
"PropertiesComponent"
>
{
"
keyToString
"
: {
"
ASKED_ADD_EXTERNAL_FILES
"
:
"
true
"
,
"
JUnit.SyncListTest.testRun.executor
"
:
"
Run
"
,
"
RunOnceActivity.OpenProjectViewOnStart
"
:
"
true
"
,
"
RunOnceActivity.ShowReadmeOnStart
"
:
"
true
"
,
"
SHARE_PROJECT_CONFIGURATION_FILES
"
:
"
true
"
,
"
git-widget-placeholder
"
:
"
task2
"
,
"
kotlin-language-version-configured
"
:
"
true
"
,
"
project.structure.last.edited
"
:
"
Modules
"
,
"
project.structure.proportion
"
:
"
0.0
"
,
"
project.structure.side.proportion
"
:
"
0.0
"
}
}
]]>
</component>
}
</component>
<component
name=
"RunManager"
selected=
"JUnit.SyncListTest.testRun"
>
<configuration
name=
"SyncListTest"
type=
"JUnit"
factoryName=
"JUnit"
temporary=
"true"
nameIsGenerated=
"true"
>
<module
name=
"SortLinkedList"
/>
...
...
src/main/java/SortList.java
View file @
ef78506d
...
...
@@ -3,10 +3,21 @@ public abstract class SortList {
public
Entry
head
;
public
long
length
;
public
long
conatinSuccess
;
public
long
conatinFailure
;
public
long
removeSuccess
;
public
long
removeFailure
;
public
SortList
()
{
this
.
head
=
new
Entry
(
Integer
.
MIN_VALUE
);
this
.
head
.
next
=
new
Entry
(
Integer
.
MAX_VALUE
);
this
.
length
=
2
;
this
.
conatinSuccess
=
0
;
this
.
conatinFailure
=
0
;
this
.
removeFailure
=
0
;
this
.
removeSuccess
=
0
;
}
public
abstract
boolean
add
(
Integer
obj
);
...
...
src/test/java/SyncListTest.java
View file @
ef78506d
...
...
@@ -32,6 +32,7 @@ public class SyncListTest extends TestCase {
List
<
Thread
>
addThreads
=
new
ArrayList
<>();
List
<
Thread
>
containThreads
=
new
ArrayList
<>();
List
<
Thread
>
removeThreads
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
AddThread
addThread
=
new
AddThread
(
seq
,
randLen
/
8
,
list
);
ContainThread
containThread
=
new
ContainThread
(
seq
,
randLen
/
8
,
list
);
...
...
@@ -44,6 +45,9 @@ public class SyncListTest extends TestCase {
removeThreads
.
add
(
threadR
);
}
// Add phase.
long
startA
=
System
.
currentTimeMillis
();
addThreads
.
stream
().
forEach
(
e
->
e
.
start
()
);
...
...
@@ -59,13 +63,14 @@ public class SyncListTest extends TestCase {
System
.
out
.
println
(
"ADD "
+
label
+
" execution task: "
+
endA
+
" ms"
);
long
listLengthAfterAdds
=
list
.
length
;
System
.
out
.
println
(
"Length of the list after adding: "
+
listLengthAfterAdds
);
String
listIsSorted
=
list
.
checkSorted
()
?
"The List is sorted"
:
"The list is not sorted"
;
System
.
out
.
println
(
listIsSorted
);
// Contain phase.
long
startC
=
System
.
currentTimeMillis
();
containThreads
.
stream
().
forEach
(
e
->
e
.
start
()
);
...
...
@@ -83,6 +88,8 @@ public class SyncListTest extends TestCase {
System
.
out
.
println
(
"Counter of Failure contain operations: "
+
list
.
conatinFailure
);
// Remove phase.
long
startR
=
System
.
currentTimeMillis
();
removeThreads
.
stream
().
forEach
(
e
->
e
.
start
()
);
...
...
@@ -97,6 +104,16 @@ public class SyncListTest extends TestCase {
System
.
out
.
println
(
"\nRemove "
+
label
+
" execution task: "
+
endR
+
" ms"
);
long
listLengthAfterRemove
=
list
.
length
;
System
.
out
.
println
(
"Length of the list after removing: "
+
listLengthAfterRemove
);
listIsSorted
=
list
.
checkSorted
()
?
"The List is sorted"
:
"The list is not sorted"
;
System
.
out
.
println
(
listIsSorted
);
System
.
out
.
println
(
"Counter of Success remove operations: "
+
list
.
removeSuccess
);
System
.
out
.
println
(
"Counter of Failure reomve operations: "
+
list
.
removeFailure
);
}
public
void
testRun
(){
...
...
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