Since you are looking for performance gains, it might be worth checking that using

   for(i = 0; i < list.length(); i++) {
       list[i];

type of notation.  Or at least googling the efficiency cost of using the iterator system.  Also I know you didn't introduce this (probably I did) but could you rename the iterators from i,j to something with iter in the name.  i and j are almost always numerical loop variables so it's a bit confusing.