Question

Implement the vector as MyVectorappend(Object element)clear()contains(Object element) elementAt(int index)

  1. class (implements Cloneable) with the following public methods:
  2. - appending the element at the end of the vector
  3. - make the vector collection empty
  4. - check whether the vector contains the element
  5. - access the element at the given index
  6. indexOf(Object element) - find the index of the element
  7. insertAt(int index, Object element) - insert the element at the given index
  8. isEmpty() - check whether the vector is empty
  9. removeAt(int index) - remove the element at the given index
  10. remove(Object element) - remove the element from the vector
  11. replace(int index, Object element) - replace the element at the given index with the given element
  12. size() - get the number of elements in the current vector
  13. ensureCapacity(int minCapacity) - make sure the vector gets at least the given capacity
  14. clone() - returns a cloned copy of this vector
  15. removeRange(int fromIndex, int toIndex) - removes from this vector all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive
  16. toString() - returns a string representation of this vector, containing the String representation of each element
  17. reverse() - reverse the elements in this vector
  18. merge(MyVector vector2) - add all the elements in vector2 to the end of this vector

Implement the vector as MyVector class (implements Cloneable) with the following public methods:
Get unstuck

321,403 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses