Skip to content

Instantly share code, notes, and snippets.

@jnslxndr
Created January 24, 2011 16:47
Show Gist options
  • Save jnslxndr/793505 to your computer and use it in GitHub Desktop.
Save jnslxndr/793505 to your computer and use it in GitHub Desktop.
How to use a static type on an ArrayList for easy iteration
// Given we need a list of things of the same type (our class "Rect") we should do:
ArrayList<Rect> listOfRects = new ArrayList();
// then we can easily iterate over this list with:
for (Rect r : listOfRects)
{
r.someFancyMethod();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment