of our simplified array list adt for examplethe class java util arraylist also includes methodclear()which removes all the elements from the array listand methodtoarray()which returns an array containing all the elements of the array list in the same order in additionthe class java util arraylist also has methods for searching the listincluding method indexof( )which returns the index of the first occurrence of an element equal to in the array listand method lastindexof( )which returns the index of the last occurrence of an element equal to in the array list both of these methods return the (invalidindex value if an element equal to is not found implementing an array list using extendable arrays in addition to implementing the methods of the indexlist interface (and some other useful methods)the class java util arraylist provides an an interesting feature that overcomes weakness in the simple array implementation specificallya major weakness of the simple array implementation for the array list adt given in section is that it requires advance specification of fixed capacitynfor the total number of elements that may be stored in the array list if the actual number of elementsnof the array list is much smaller than nthen this implementation will waste space worseif increases past nthen this implementation will crash insteadthe java util arraylist uses an interesting extendable-array technique so that we never have to worry about array overflows when using this class as with the java util arraylist classlet us provide means to grow the array that stores the elements of an array list of coursein java (and other programming languages)we cannot actually grow the array aits capacity is fixed at some number nas we have already observed insteadwhen an overflow occursthat iswhen and we make call to the method addwe perform the following additional steps allocate new array of capacity let [ ] [ ]for let bthat iswe use as the array supporting insert the new element in