I was wondering, is the size() method that you can call on a existing ArrayList cached? Or is it preferable in performance critical code t
size()
ArrayList
The obvious implementation of ArrayList would be to store the size internally in a field. I would be very surprised if it ever had to be computed, even after resizing.