if (foo)
return false;
else
return true;
>>58106114
>if (POO)
return false;
else
return true;
>>58106114
return foo == false;
>>58106134
>>58106134
return !foo;
>>58106114return !foo;
>>58106114
if (foo)
Printf("poo in the loo") ;
return false;
else
Printf("OP is a fag") ;
return true;
>>58106114
<code>
if (foo)
return !foo;
else
return foo;
<code>
>>58106184
>no scope
>upper case printf
>lacking indent
Do you even program
>>58106114try
{
if (foo == true)
{
return new Boolean(false);
}
else if (foo == false)
{
return new Boolean(true);
}
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}
>>58106192
>using the carat tag block
>>58106265
I've come up with a better one:private static Boolean reverseTruthValueOfBoolean(Boolean foo) throws Exception {
Boolean theValueToBeReturnedFromThisMethod = null;
try
{
if (foo.equals(Boolean.TRUE) == true)
{
theValueToBeReturnedFromThisMethod = new Boolean(false);
}
else if (foo.equals(Boolean.FALSE) == true)
{
theValueToBeReturnedFromThisMethod = new Boolean(true);
}
else
{
throw new NullPointerException();
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
return theValueToBeReturnedFromThisMethod;
}
}
>>58106114
I've actually had a manager that would bitch to me if I had written "return !foo;" in this case, because that would have been too obfuscated and code is meant to be read by other people and yadda yadda. Fuck that.
>>58106353
you should have...
BooleanFactory booleans = new BooleanFactory(BooleanFactory.PRIMITIVE_BOOLEANS);
...
BooleanFactory.makeTrue()
...
BooleanFactory.makeFalse()
instead
>>58106373
Trinary, GOMLreturn foo ? false : true;
>>58106373
oops, has to be "booleans.make..." of course
>>58106360
I expect "other people" to be able to understand a simple boolean negation.
If they can't I'm clearly in a company run by baboons
>>58106373
I can think of lots of things to do to make that code even more like idiomatic Java, but I really can't be fucked typing out that much code.
>>58106383
thank god, you made a factory.
can you cache a singleton instance of the wrapped holder so that we can have multiple contexts without recreating the underlying dataset? i think that would perform much better and make a lot of pattern fags happy.