From: Jérôme Benoit Date: Sun, 4 Mar 2018 19:50:38 +0000 (+0100) Subject: TP2: Simplify chained conditions. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=dbd5b97740865a496231e49a086ca3dd325aecdf;p=TP_POO.git TP2: Simplify chained conditions. Signed-off-by: Jérôme Benoit --- diff --git a/TP2/Liste.java b/TP2/Liste.java index 344a2d3..e042612 100644 --- a/TP2/Liste.java +++ b/TP2/Liste.java @@ -139,9 +139,7 @@ public class Liste extends Structure { 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;