If... Posted by kevinrutherford on Friday April 29, 2011 @03:05AM from the silkandspinach.net dept. http://silkandspinach.net/2011/04/29/if-2/ ( 2 comments | 6 points | on HN )
Can you give an example?
File createFile(String name, boolean istemp) { if (istemp) // do temp stuff else // do regular file stuff }
That's an 'if' statement that only exists as a response to the boolean parameter. We can remove the 'if' by having two methods instead:
File createFile(String name) File createTempFile(String name)