-
Notifications
You must be signed in to change notification settings - Fork 11
Upgrade complete implementation of LinkedList #7
Conversation
} | ||
|
||
private Node<E> findTail() { | ||
Node<E> followingNode = Objects.requireNonNull(head); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you name it followingNode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shouldn't name it so.
Changing that variable name to currentNode.
return LookForElement(element); | ||
} | ||
|
||
private boolean LookForElement(E element) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the best name for method. It does not follow naming convention. In addition, it would be better to put this code into method contains()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, moving code to contains()
method.
|
||
@Test | ||
public void testAddElement() { | ||
testLinkedList.add(7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use BUILD OPERATE ASSERT pattern for test methods. E.g. you separate three parts of a test using empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applying the pattern.
…ode` - move `LookForElement()` code to method `contains()` and delete `LookForElement()` method - apply BUILD OPERATE ASSERT pattern to `LinkedListTest`
No description provided.