reducing no: of objects created, to improve performance...
with the original code being the following, can i reduce the no: of times that objects(GifFileSelector objects..) are created in the method 'open()' by using the coding that i have put below???
The objects are not created within a for loop continuously.. so i'm not sure if i can make any change to 'reuse objects'.. (provided this open() method is called several times) original : Code:
public class FileMenu extends AbstractMenu Code:
public class FileMenu extends AbstractMenu |
yes, the code you used is what you would typically find in a getter method (beans anyone).
Code:
public GifFileSelector getFileSelector(){ |
so does that mean, that i 'm not making any difference(performance improvement) at all to the code, provided the open method is called more than once???
i mean if the open method is called (more than one picture is being opened at different times) am i not reducing the no: of objects being created ..? |
Quote:
Quote:
|
okay.. thanks! :)
well need a lil clarification... If this particular open() method is called only 'once' , both the original coding and my code will do the same thing , ya? Since, in the modified code that i put, 'g' will be equal to NULL, the object will be created for the first time ya? |
you are correct
|
All times are GMT -5. The time now is 02:15 PM. |