src/main/java/de/uniks/networkparser/ext/petaf/messages/ConnectMessage.java
These nested if statements could be combined Open
Open
if (sender.sendMessage(acceptTaskSend)) {
this.getReceiver().withOnline(true);
}
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}