Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

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

 
Rick Reumann
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.)
 
    Bookmark Topic Watch Topic
  • New Topic