Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Sample Singleton Class */
- public class Singleton {
- public static Singleton singleton = null;
- protected Singleton(){}
- public static Singleton get(){
- if(singleton == null){
- singleton = new Singleton();
- }
- return singleton
- }
- public boolean uselessFuction(){
- return true;//Lets pretend this does something usefull
- }
- /* HERE IS THE QUESTION */
- /* Should I do this: */
- public boolean loggedIn(){
- boolean somethingUsefull = Singleton.get().uselessFunction();
- return !somethingUsefull;
- }
- /* OR this: */
- public boolean loggedIn(){
- boolean somethingUsefull = uselessFunction();
- return !somethingUsefull;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement