X-Git-Url: https://git.piment-noir.org/?p=TP_POO.git;a=blobdiff_plain;f=TP2%2FEntiers.java;h=b690d10426728590f0efa8365a448f1cd531baa6;hp=80fcc9016434b0b5ec16c3f946c1999e37097fa3;hb=22758baf926b8b833ce6a38566eb157e13fbd3fb;hpb=c7c510eb1829b97b642bd584a8737103b07efeb7 diff --git a/TP2/Entiers.java b/TP2/Entiers.java index 80fcc90..b690d10 100644 --- a/TP2/Entiers.java +++ b/TP2/Entiers.java @@ -75,7 +75,6 @@ class Entiers extends Structure { System.out.println("Aucune valeur à supprimer"); return false; } - for (int i = 0; i < getCurrentSize(); i++) { if (int_array[i] == value) { // Deleting the element in the tab @@ -105,4 +104,13 @@ class Entiers extends Structure { } } + public void compacter(int nElements) { + if (current_size - nElements > 0) { + // Remove the last nElements + current_size -= nElements; + } else { + current_size = 0; + } + } + }