security - Usage of myBoolean = !myBoolean -


i've seen kind of statement few times in java code. example when wanting set button not visible in vaadin framework (or equivalent):

boolean access = authorizator.isadmin(); access = !access; savebutton.setvisible(access); 

why not this:

boolean access = authorizator.isadmin();     if(!access) {     savebutton.setvisible(false); } 

your second example not same. sets button invisible, never sets visible. cleanest (imho) , functionally equal first be

savebutton.setvisible(!authorizer.isadmin()); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -