*
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 Android Security Essentials Live Lessons this week in the Android 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
 
 
subject: Is there an optimization advantage in doing as shown in test2() below
 
Similar Threads
FilteredIterator
Enumeration
What kind posible exception thrown
Is there an optimization advantage in doing as shown in test2() below
??? Difference Between Iterator & Enumeration ???