21 July 2008

Java wishlist - disable foreach on lists

The foreach loop will iterate a list using an iterator rather than by get(int) access. This is less efficient when called many times in tight loops. I wish I could easily detect when foreach has been used on a list.