Consider the interface below: package prelim; import java.util.NoSuchElementException; public interface MyList { public int getSize(); public void insert(E data) throws ListOverflowException; public E getElement(E data) throws NoSuchElementException; public boolean delete(E data); // returns false if the data is not deleted in the list public boolean search(E data); // returns index of data, else -1 is return
Java code
Consider the interface below:
package prelim;
import java.util.NoSuchElementException;
public interface MyList<E> {
public int getSize();
public void insert(E data) throws ListOverflowException;
public E getElement(E data) throws NoSuchElementException;
public boolean delete(E data); // returns false if the data is not deleted in the list
public boolean search(E data); // returns index of data, else -1 is return
Create implementations of the above interface in different ways as stipulated below.Use an array object to store the elements of the list object. This array object will have a fixed size of five (5) and that an attempt to insert an element into the array when full will result to a ListOverflowException.
Step by step
Solved in 2 steps with 3 images