Will the array get smaller?

Sir , in this lecture, when the size = 4 ans also the default capacity is also 4 a new array is at created at position 16k of length 8, But now if i remove integer at index 3, will this array(of 8 length) get destroyed and a new array at an address lets say 18k will be created of length 4 again?

Hi @brahatsingh32,
For a array list that we create we wont decrease the size of the arrayList but there is a function for in-built arrayList which is trimToSize() that would reduce the size to current list capacity for storage efficiency reasons.
Hope this helps

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.