Set StringList Appendable.

This commit is contained in:
Christian P. MOMON 2017-12-25 22:42:54 +01:00
parent 0df573322d
commit fc2d92c25f

View file

@ -18,6 +18,7 @@
*/ */
package fr.devinsy.util.strings; package fr.devinsy.util.strings;
import java.io.IOException;
import java.text.Collator; import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -34,7 +35,7 @@ import org.apache.commons.lang3.StringUtils;
* concatenation action. * concatenation action.
* *
*/ */
public class StringList extends ArrayList<String> implements CharSequence public class StringList extends ArrayList<String> implements CharSequence, Appendable
{ {
private static final long serialVersionUID = -1154185934830213732L; private static final long serialVersionUID = -1154185934830213732L;
@ -152,6 +153,7 @@ public class StringList extends ArrayList<String> implements CharSequence
* @param character * @param character
* @return * @return
*/ */
@Override
public StringList append(final char character) public StringList append(final char character)
{ {
StringList result; StringList result;
@ -164,6 +166,44 @@ public class StringList extends ArrayList<String> implements CharSequence
return result; 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 * Appends the string of the specified collection, in the order they are
* returned by the collection's iterator. * returned by the collection's iterator.