Question: Java | I need help filling out the methods for the DoubleLinkedSeq class here are the specifications for each method - DoubleLinkedSeq: No - Arg

Java | I need help filling out the methods for the DoubleLinkedSeq class here are the specifications for each method -DoubleLinkedSeq: No-Arg-
This constructor initializes all fields to their falsy values. Zero is the falsy value for numbers and null is the falsy value for objects.
-size-
This method returns the number of elements in the sequence.
-addAfter-
This method adds a new element to the sequence.
If a cursor element exists then the new element is placed after the cursor element.
If no cursor element exists then the new element is placed at the end of the sequence.
If the sequence is empty then this will now be the only element in the sequence.
In all cases, the newly added element becomes the new cursor element of the sequence.
-addBefore-
This method adds a new element to the sequence.
If a cursor element exists then the new element is placed before the cursor element.
If no cursor element exists then the new element is placed at the beginning of the sequence.
If the sequence is empty then this will now be the only element in the sequence.
In all cases, the newly added element becomes the new cursor element of the sequence.
-addAll-
This method takes another sequence and places the contents of that sequence at the end of the current sequence.
The cursor element of the sequence remains where it is.
You have to consider that a list could be added to itself. In this scenario, you could run into an infinite loop if you are just trying to loop through the addend list until you reach the end.
-isCurrent-
This method returns true if a specified cursor element exists and false otherwise.
-start-
This method sets the cursor element at the front of the sequence. If the sequence is empty then there is no cursor element.
-advance-
If there is a current element, this method moves the cursor element forward.
If a cursor element does not exist then it should throw an IllegalStateException.
-getCurrent-
This method returns the data at the cursor element if there is one.
If a cursor element does not exist then it should throw an IllegalStateException.
-removeCurrent-
If a cursor element exists then this method will remove the cursor element from the sequence. The following element will become the new cursor element.
If there is no following element then there will now be no cursor element.
If a cursor element does not exist then you will need to throw an IllegalStateException.
-clone-
This method creates a copy of the sequence.
Changes to the copy should not affect the original sequence or vice versa.
Everything in the new sequence should be the same as the current sequence.
-toString-
This method returns a string representation of the sequence.
The string should be surrounded by angle brackets, with each element, in order, separated by commas. If there is a cursor element it should be surrounded by square brackets.
Examples:
>
7.7,2.1>
1.1,[2.2],3.3>
-equals-
This method returns true if two sequences are equal.
Sequences are equal if:
They have the same number of elements.
Each corresponding element is the same.
The cursor and precursor are the same.
-concatenation-
This is a static method that is used to create a sequence out of two existing sequences.
The created sequence should have all of the elements from the first parameter, in order, followed by all of the elements from the second parameter, in order.
There should be no cursor element.
 Java | I need help filling out the methods for the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!