From 471c182b1df38a97edaa66df75c749a8ad6e7e11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 8 Feb 2018 12:30:42 +0100 Subject: [PATCH] Adress a FIXME on duplicated values insertion. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- Entiers/Entiers.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Entiers/Entiers.java b/Entiers/Entiers.java index 752546b..2159b95 100644 --- a/Entiers/Entiers.java +++ b/Entiers/Entiers.java @@ -31,7 +31,12 @@ class Entiers { System.out.println("Tableau plein"); return false; } - //FIXME: Avoid duplicated values + int pos = binarySearch(0, getCurrentSize(), value); + if (pos != -1) + { + System.out.println("Valeur à inserer déjà présente"); + return false; + } int i; for (i = getCurrentSize() - 1; (i >= 0 && int_array[i] > value); i--) { int_array[i + 1] = int_array[i]; -- 2.34.1