   [java] Iterator question
  Curious if anyone knows if the Iterator returned from most of the Java Util Collection classes is created when requested, or if it is just an object that can traverse the backing store?L-   
  It not only traverses the Collection, it can also perform one single modification to it: remove().Iterator < GameObject > gObjs = readyToFree.iterator();while ( gObjs.hasNext() ) {  it.next().freeResources();  it.remove();}As per its creation, I think (but I'm not sure) they are just an object that can traverse the backing store. But since we have different Iterator implementations in the API, there can be different behaviors for their instatiation as well. I don't know the API in deep detail to answer that, but the above note seemed necessary, so I posted ;)Son Of Cain   ;  Since the source code of the API is part of suns JDK, you can easily have a look.At least for JDK1.5, it is created when you call AbstractList.iterator() via new.   ;  Thanks Son of CainQuote:Original post by nmiSince the source code of the API is part of suns JDK, you can easily have a look.At least for JDK1.5, it is created when you call AbstractList.iterator() via new.Yeah, I realize -- but I was wonderring if someone knew -- I I'll check what the case is.L-