Create your own ArrayList
class which implements the List
interface. Override the methods required.
Make your ArrayList
behave the same way as java.util.ArrayList
(it should have the default capacity, the internal array should grow 1.5 times when it is full, etc.).
Throw custom ArrayListIndexOutOfBoundsException
in case the index passed to any of the methods is invalid.
Throw NoSuchElementException
in remove(T element)
if there is no such element present.