6 Replies Latest reply on Mar 1, 2011 2:23 PM by Leaf Woods

    List: toArray() vs. iterator, which is more efficient

    Leaf Woods

      I have a List to process (jdk1.5). I could use toArray() to turn it to an array and use for loop to process the elements one by one. Or I could use its iterator. Which is more efficient?

      PS: One way direction. The elements have to be processed one by one in natural order. I didn't see the benefit to convert it to an array unless it is more efficient.