From 480ff9f544cf66c5ee99268f4677a0b389815538 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 12 Jan 2019 12:22:23 +0100 Subject: [PATCH] Do not create a new instance recursively for nothing to display the list of valid colors name. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/Eye.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Eye.java b/src/Eye.java index 6b71f35..5961244 100644 --- a/src/Eye.java +++ b/src/Eye.java @@ -27,7 +27,7 @@ public class Eye implements Comparable { if (validateColor(strColor)) { this.strColor = strColor; } else { - throw new IllegalArgumentException("Color must be" + new Eye().colorListToString()); + throw new IllegalArgumentException("Color must be" + this.colorListToString()); } } @@ -51,9 +51,8 @@ public class Eye implements Comparable { this.color = new Color(88, 41, 0); else this.color = Color.getColor(color); - } else { - throw new IllegalArgumentException("Color must be" + new Eye().colorListToString()); + throw new IllegalArgumentException("Color must be" + this.colorListToString()); } } -- 2.34.1