From fc2d92c25f4da112115783071534e0224b76008c Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 25 Dec 2017 22:42:54 +0100 Subject: [PATCH] Set StringList Appendable. --- src/fr/devinsy/util/strings/StringList.java | 42 ++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/fr/devinsy/util/strings/StringList.java b/src/fr/devinsy/util/strings/StringList.java index 8b64bee..fb9bb79 100644 --- a/src/fr/devinsy/util/strings/StringList.java +++ b/src/fr/devinsy/util/strings/StringList.java @@ -18,6 +18,7 @@ */ package fr.devinsy.util.strings; +import java.io.IOException; import java.text.Collator; import java.util.ArrayList; import java.util.Collection; @@ -34,7 +35,7 @@ import org.apache.commons.lang3.StringUtils; * concatenation action. * */ -public class StringList extends ArrayList implements CharSequence +public class StringList extends ArrayList implements CharSequence, Appendable { private static final long serialVersionUID = -1154185934830213732L; @@ -152,6 +153,7 @@ public class StringList extends ArrayList implements CharSequence * @param character * @return */ + @Override public StringList append(final char character) { StringList result; @@ -164,6 +166,44 @@ public class StringList extends ArrayList implements CharSequence return result; } + /* (non-Javadoc) + * @see java.lang.Appendable#append(java.lang.CharSequence) + */ + @Override + public StringList append(final CharSequence charSequence) throws IOException + { + StringList result; + + if (charSequence != null) + { + this.append(charSequence.toString()); + } + + result = this; + + // + return result; + } + + /* (non-Javadoc) + * @see java.lang.Appendable#append(java.lang.CharSequence, int, int) + */ + @Override + public StringList append(final CharSequence charSequence, final int start, final int end) throws IOException + { + StringList result; + + if (charSequence != null) + { + this.append(charSequence.subSequence(start, end).toString()); + } + + result = this; + + // + return result; + } + /** * Appends the string of the specified collection, in the order they are * returned by the collection's iterator.