Capacity Enhancements
Modify the ListType class presented in this chapter by adding the following methods:
• public int getCapacity()
This method should return the current capacity of the list.
•public void ensureCapacity(int minCapacity)
If the list's capacity is less than minCapacity, this method should increase it so it is equal to minCapacity.
•public void trimToSize()
This method trims the list's capacity so it is equal to the list's current size.
Demonstrate the new methods in a simple program.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.