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
d8f16659
Commit
d8f16659
authored
Nov 10, 2025
by
saad.aswad
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into task2
# Conflicts: # src/main/java/SortList.java
parents
0d6fe042
8baca9c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
SortList.java
src/main/java/SortList.java
+11
-6
SyncListTest.java
src/test/java/SyncListTest.java
+3
-0
No files found.
src/main/java/SortList.java
View file @
d8f16659
...
@@ -3,15 +3,10 @@ public abstract class SortList {
...
@@ -3,15 +3,10 @@ public abstract class SortList {
public
Entry
head
;
public
Entry
head
;
public
long
length
;
public
long
length
;
public
long
conatinSuccess
=
0
;
public
long
conatinFailure
=
0
;
public
long
removeSuccess
=
0
;
public
long
removeFailure
=
0
;
public
SortList
()
{
public
SortList
()
{
this
.
head
=
new
Entry
(
Integer
.
MIN_VALUE
);
this
.
head
=
new
Entry
(
Integer
.
MIN_VALUE
);
this
.
head
.
next
=
new
Entry
(
Integer
.
MAX_VALUE
);
this
.
head
.
next
=
new
Entry
(
Integer
.
MAX_VALUE
);
this
.
length
=
0
;
this
.
length
=
2
;
}
}
public
abstract
boolean
add
(
Integer
obj
);
public
abstract
boolean
add
(
Integer
obj
);
...
@@ -27,6 +22,16 @@ public abstract class SortList {
...
@@ -27,6 +22,16 @@ public abstract class SortList {
}
}
}
}
public
boolean
checkSorted
()
{
Entry
current
=
this
.
head
.
next
;
while
(
current
.
next
!=
null
)
{
if
(
current
.
object
.
compareTo
(
current
.
next
.
object
)
>
0
)
{
return
false
;
}
current
=
current
.
next
;
}
return
true
;
}
}
}
src/test/java/SyncListTest.java
View file @
d8f16659
...
@@ -61,6 +61,9 @@ public class SyncListTest extends TestCase {
...
@@ -61,6 +61,9 @@ public class SyncListTest extends TestCase {
long
listLengthAfterAdds
=
list
.
length
;
long
listLengthAfterAdds
=
list
.
length
;
System
.
out
.
println
(
"Length of the list after adding: "
+
listLengthAfterAdds
);
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
);
long
startC
=
System
.
currentTimeMillis
();
long
startC
=
System
.
currentTimeMillis
();
...
...
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