Set StringList Appendable.
This commit is contained in:
parent
0df573322d
commit
fc2d92c25f
1 changed files with 41 additions and 1 deletions
|
@ -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<String> implements CharSequence
|
||||
public class StringList extends ArrayList<String> implements CharSequence, Appendable
|
||||
{
|
||||
private static final long serialVersionUID = -1154185934830213732L;
|
||||
|
||||
|
@ -152,6 +153,7 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
* @param character
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public StringList append(final char character)
|
||||
{
|
||||
StringList result;
|
||||
|
@ -164,6 +166,44 @@ public class StringList extends ArrayList<String> 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.
|
||||
|
|
Loading…
Reference in a new issue