
LinkedList Exercise
The following Java class definitions will be used for the exercises below.
public class MyLinkedList {
private class Node {
private Object data;
private Node next;
public Node(Object data) {
this.data = data;
next = null;
}
}
}
IMPORTANT: You may not use the Java API LinkedList class.
1. Implement a MyLinkedList constructor that defines an empty linked list.
2. Implement a method named isEmpty that determines whether a list is empty.
3. Implement a method named size that returns the number of elements in the list.
4. Implement a MyLinkedList constructor that has the following signature:
MyLinkedList(ArrayList<Object> dataArray)
The constructor will initialize the linked list using the data elements from the array.
5. Implement a method named duplicate that creates a duplicate (shallow copy) of the list.
6. Would it be possible to implement a method that determines whether a list is full?