Question: for the MyLinkedList and try to implement the following methods : / * @author rawhi * * To modify 'Fork the project' * / public

for the MyLinkedList and try to implement the following methods : /*@author rawhi
*
* To modify 'Fork the project'
*/
public class Node {
private Object data; //private??
public Node next; //public??
public Node(Object newData){
data = newData;
next = null;
}
public Object getData(){
return data;
}
public void setData(Object newData){
data = newData;
}
}1. Method void addList(MyLinkedList list2): Adds list2 to the existing list.
2. Method void copyList(MyLinkedList list2): Copies list2 into the existing
list.
3. Method Object getMin(): Returns the data of the node with the minimum value
compared to other values in the list.
4. Method void reversePrint(): Prints the data of the list in reverse order without
changing the original order.
5. Method boolean replaceNode(Node newNode, int pos): Replaces the node
at the specific position pos with newNode and returns true if the process succeeds.
6. Method boolean updateData(Object newData, int pos): Updates the node
at the specific position pos with newData and returns true if the process succeeds.
7. Method Object[] toArray(): Returns an array of objects equivalent to the
current linked list.
8. Method MyLinkedList toList(Object[] array): Converts the array of objects
in the parameter to a linked list and returns the equivalent MyLinkedList.

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 Programming Questions!