aspose file tools*
The moose likes Java in General and the fly likes Is there an optimization advantage in doing as shown in test2() below Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Is there an optimization advantage in doing as shown in test2() below

Rick Reumann
Ranch Hand

Joined: Apr 03, 2001
Posts: 281
I posted this in the beginner forum, so sorry for the cross post, not really sure where it fits...

Is there any advantage from a performance standpoint in declaring an object outside of an interation loop before you go through and assign it references as the condition iterates (even if the collection is very large)? I would think there would be no performance advantage between test1 and test2 below but I want to be certain.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Rick Reumann:
I posted this in the beginner forum, so sorry for the cross post, not really sure where it fits...

To avoid people duplicating efforts, please continue this discussion under the other post which has already received a response. (Please don't cross-post.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Is there an optimization advantage in doing as shown in test2() below
 
Similar Threads
??? Difference Between Iterator & Enumeration ???
Is there an optimization advantage in doing as shown in test2() below
Enumeration
FilteredIterator
What kind posible exception thrown