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
I don't think I'd say it's "cached" as such - but it's just stored in a field, so it's fast enough to call frequently.
The Sun JDK implementation of size() is just:
public int size() { return size; }