Question: Java8 programming, generics,collections,interfaces; please explain in detail Question 4: Generic Array You are to implement a generic array that will allow any only data of

Java8 programming, generics,collections,interfaces; please explain in detail

Java8 programming, generics,collections,interfaces; please explain in detail Question 4: Generic Array You

Question 4: Generic Array You are to implement a generic array that will allow any only data of a specific type added to the array. public class GenericArray { private T[] array; public GenericArray () { //initialise array here //Define your remaining methods The array must support the following operations: long size (), returns the capacity of the array. T set (int index, T element), sets an element in the array. Tget (int index), returns an element at a specific index, should throw IndexOutOf- BoundsError if index is = size(). long resize (long newSize), returns the old size and resizes the array

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!