Question: Need help completing the methods for an ARRAY LINEAR LIST. below are the constructors (JAVA) HELP, can someone complete the methods below for an ARRAY

Need help completing the methods for an ARRAY LINEAR LIST. below are the constructors (JAVA)

 Need help completing the methods for an ARRAY LINEAR LIST. below

HELP, can someone complete the methods below for an ARRAY LINEAR LIST. (JAVA)

/* Removes and returns the parameter object obj in first position in list if * the list is not empty, null if the list is empty. */ public E removeFirst(); /* Removes and returns the parameter object obj in last position in list if * the list is not empty, null if the list is empty. */ public E removeLast(); /* Removes and returns the parameter object obj from the list if the list * contains it, null otherwise. The ordering of the list is preserved. * The list may contain duplicate elements. This method removes and returns * the first matching element found when traversing the list from first * position. * Note that you may have to shift elements to fill in the slot where the * deleted element was located. */ public E remove(E obj); /* Returns the first element in the list, null if the list is empty. * The list is not modified. */ public E peekFirst(); /* Returns the last element in the list, null if the list is empty. * The list is not modified. */ public E peekLast();

/* Returns true if the parameter object obj is in the list, false otherwise. * The list is not modified. */ public boolean contains(E obj); /* Returns the element matching obj if it is in the list, null otherwise. * In the case of duplicates, this method returns the element closest to front. * The list is not modified. */ public E find(E obj);

/* The list is returned to an empty state. */ public void clear();

/* Returns true if the list is empty, otherwise false */ public boolean isEmpty(); /* Returns true if the list is full, otherwise false */ public boolean isFull();

/* Returns the number of objects currently in the list. */ public int size(); /* Returns an Iterator of the values in the list, presented in * the same order as the underlying order of the list. (front first, rear * last). */ public Iterator iterator();

}

maiN OY 7 8 9 10 11 14 1e import java.util.Iterator; 2 import java.util.NoSuchelementException; 3 import java.util.concurrentModificationException; 5 public class ArrayLinearList implements LinearListADT { // TODO Auto-generated method stub private object[] array; private int front; private int back; private int capacity; private int size; 12 130 public ArrayLinearList() { 15 capacity DEFAULT_MAX_CAPACITY; 16 array = new Object[capacity]; 17 front = 0; 18 back = front + 1; size = 0; } 21 22 public ArrayLinearList(int maxCapacity) 23 { 24 capacity = maxCapacity; 25 array = new Object[capacity]: 26 front = 0; 27 back = front + 1; 28 size = @; 29 } 19 20 39

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!