Dynamic sizing
Dynamic sizing
In contrast to Arrays, Lists (ArrayLists) size is dynamic. It increases it size automatically as we add more and more elements.
💡 Wondering How?
Well, it is an array internally & has some predefined size initially. While adding elements if it is about to fill up, its size gets doubled to accomodate more elements!
By-default immutable
By-default immutable
ArrayLists once created are by-default immuatble i.e. items can not be added or removed. If we want to do so, we use MutableList.