TP2: Simplify chained conditions.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 4 Mar 2018 19:50:38 +0000 (20:50 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 4 Mar 2018 19:50:38 +0000 (20:50 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP2/Liste.java

index 344a2d3325f134a76399c72892b4dbc996768f18..e042612b15c0f8abdf4bcc32e8bf48ea3829c14b 100644 (file)
@@ -139,9 +139,7 @@ public class Liste extends Structure {
 
     public void compacter(int nElements) {
         // Remove the first nElements
 
     public void compacter(int nElements) {
         // Remove the first nElements
-        if (isEmpty()) {
-            return;
-        } else if (nElements == 0) {
+        if (isEmpty() || nElements == 0) {
             return;
         } else if (headNode != null && headNode.getNext() == null) {
             headNode = null;
             return;
         } else if (headNode != null && headNode.getNext() == null) {
             headNode = null;