From cd9e30def7f1342ce63cd1783efa4f7d5ebad92e Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 21 Sep 2015 13:03:44 +0200 Subject: [PATCH] Refactor methods (small). --- src/fr/devinsy/util/strings/StringSet.java | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/fr/devinsy/util/strings/StringSet.java b/src/fr/devinsy/util/strings/StringSet.java index d4e10b5..125c1ec 100644 --- a/src/fr/devinsy/util/strings/StringSet.java +++ b/src/fr/devinsy/util/strings/StringSet.java @@ -20,7 +20,6 @@ package fr.devinsy.util.strings; import java.util.Collection; import java.util.HashSet; -import java.util.List; /** * This class is a set of String objects with specific methods. It makes @@ -127,7 +126,7 @@ public class StringSet extends HashSet /** * */ - public StringSet append(final StringSet strings) + public StringSet add(final StringSet strings) { StringSet result; @@ -235,24 +234,6 @@ public class StringSet extends HashSet return result; } - /** - * - */ - public StringSet put(final Double value) - { - StringSet result; - - if (value != null) - { - this.put(String.valueOf(value)); - } - - result = this; - - // - return result; - } - /** * */ @@ -269,19 +250,11 @@ public class StringSet extends HashSet /** * */ - public StringSet put(final List strings) + public StringSet put(final long value) { StringSet result; - if (strings != null) - { - for (String string : strings) - { - this.put(string); - } - } - - result = this; + result = this.put(String.valueOf(value)); // return result; @@ -290,11 +263,16 @@ public class StringSet extends HashSet /** * */ - public StringSet put(final long value) + public StringSet put(final Object value) { StringSet result; - result = this.put(String.valueOf(value)); + if (value != null) + { + this.put(value.toString()); + } + + result = this; // return result; @@ -381,6 +359,28 @@ public class StringSet extends HashSet return result; } + /** + * + */ + public StringSet putNullable(final Object value) + { + StringSet result; + + if (value == null) + { + super.add((String) null); + } + else + { + this.put(value.toString()); + } + + result = this; + + // + return result; + } + /** * */