Tech
Examining the "Boolean-Switch" in Java \_(ツ)_/
While reading through some ai-generated code today, I was caught off guard when I saw a switch statement inside of a boolean. What on earth has ai done now, I wondered. Here is the suspect:
public boolean canChangeTo ( OrderStatus newStatus ) {
switch ( this ) {
case PLACED:
return newStatus == PROCESSING || newStatus == CANCELLED ;
case PROCESSING:
return newStatus == ...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to