Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
306
306Ass4
Commits
76f2f0b1
Commit
76f2f0b1
authored
Feb 25, 2019
by
michael lundquist
Browse files
Fixing a bug in the doublyLinkedList.
parent
35c71586
Pipeline
#3985
passed with stage
in 1 minute and 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fourthassignment/src/main/java/com/ds/fourthassignment/DoublyLinkedList.java
View file @
76f2f0b1
...
...
@@ -45,12 +45,12 @@ public class DoublyLinkedList {
}
public
boolean
remove
(
S
tring
query
){
public
boolean
remove
(
S
cientist
query
){
boolean
flag
=
false
;
if
(
size
==
0
)
return
flag
;
DoublyLNode
current
=
head
;
do
{
if
(
current
.
getData
().
equals
(
query
)){
if
(
current
.
getData
().
compareTo
(
query
)
==
0
){
//remove current
DoublyLNode
prev
=
current
.
getPrevious
();
DoublyLNode
next
=
current
.
getNext
();
...
...
fourthassignment/src/test/java/com/ds/fourthassignment/Test_DoublyLinkedList.java
View file @
76f2f0b1
...
...
@@ -4,13 +4,13 @@ public class Test_DoublyLinkedList {
public
static
void
main
(
String
[]
args
){
DoublyLinkedList
dlist
=
new
DoublyLinkedList
();
dlist
.
addToHead
(
new
DoublyLNode
(
"1"
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
"2"
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
"3"
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
"4"
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
new
Scientist
(
"A"
)
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
new
Scientist
(
"B"
)
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
new
Scientist
(
"D"
)
,
null
,
null
));
dlist
.
addToHead
(
new
DoublyLNode
(
new
Scientist
(
"J"
)
,
null
,
null
));
System
.
out
.
println
(
dlist
.
display
());
dlist
.
remove
(
"3"
);
dlist
.
remove
(
new
Scientist
(
"B"
)
);
System
.
out
.
println
(
dlist
.
display
());
}
}
\ No newline at end of file
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