• Post Reply Bookmark Topic Watch Topic
  • New Topic

One question  RSS feed

 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone i ask you one question i am little bit confused tell me if there is any difference between the codes below.

P.S: <ibp:showObjects> is our custom tag library it basicly iterates objects like for iteration anyway and i get the current object inside the iteration using ibp.get so assume that these are standart jsp code.





As you see above in the first one i declare LinkedList out of iteration (ibp:showObject) and clear eachtime inside the loop and in the second code i declare LinkedList inside the iteration and of course no need to clear them because eachtime they are re-created.

Hope you understand.

Thanks in advance
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difficult to be sure because you only have a short piece of code without {}, but if you are declaring your Lists as local variables rather than fields they will go out of scope and you can't use them again.
Also you will have a performance overhead with the multiple instantiations.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!