Example 1:
source: http://docs.oracle.com/javase/6/docs/api/java/util/RandomAccess.html
for (int i=0, n=list.size(); i < n; i++)
list.get(i);
runs faster than this loop: for (Iterator i=list.iterator(); i.hasNext(); )
i.next();
source: http://docs.oracle.com/javase/6/docs/api/java/util/RandomAccess.html
No comments:
Post a Comment