Task: implement a myVector container — a dynamic array for storing arbitrary data type.
Instructions for execution: myVector.java — description of the vector class, prototypes of methods, implementation of methods;
- the myVector class must be a template;
- the myVector class must contain the following fields: an array reference; current number of elements; maximum number of elements;
- the myVector class must contain the following methods: designer; copy constructor; adding an element to the end; deleting the last element; deleting an item by index; inserting an element by index; changing the size of the array; clearing the array (deleting all elements); getting the current and maximum container size;
- the user should be able to set the initial the number of elements in the array using the constructor;
- if the number of elements due to the addition of new ones exceeds maximum, it is necessary to re-allocate memory, copy existing elements
- if it is impossible to delete the element, access the element and etc. exceptions should be generated;