From f07a3649343736abd580427bf36eb40857f10180 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 5 May 2017 10:13:16 +0200 Subject: [PATCH] Added basic append method for many types. --- src/fr/devinsy/util/strings/StringList.java | 168 ++++++++++++++++++++ 1 file changed, 168 insertions(+) diff --git a/src/fr/devinsy/util/strings/StringList.java b/src/fr/devinsy/util/strings/StringList.java index b39073e..922d88a 100644 --- a/src/fr/devinsy/util/strings/StringList.java +++ b/src/fr/devinsy/util/strings/StringList.java @@ -105,6 +105,54 @@ public class StringList extends ArrayList implements CharSequence } } + /** + * Appends the string of the array argument to this boolean list. + * + * @param strings + * @return + */ + public StringList append(final boolean... items) + { + StringList result; + + if (items != null) + { + for (boolean item : items) + { + this.append(item); + } + } + + result = this; + + // + return result; + } + + /** + * Appends the string of the array argument to this byte list. + * + * @param strings + * @return + */ + public StringList append(final byte... items) + { + StringList result; + + if (items != null) + { + for (byte item : items) + { + this.append(item); + } + } + + result = this; + + // + return result; + } + /** * Appends the string representation of the char argument to this string * list. @@ -124,6 +172,30 @@ public class StringList extends ArrayList implements CharSequence return result; } + /** + * Appends the string of the array argument to this char list. + * + * @param strings + * @return + */ + public StringList append(final char... items) + { + StringList result; + + if (items != null) + { + for (char item : items) + { + this.append(item); + } + } + + result = this; + + // + return result; + } + /** * Appends the string of the specified collection, in the order they are * returned by the collection's iterator. @@ -222,6 +294,30 @@ public class StringList extends ArrayList implements CharSequence return result; } + /** + * Appends the string of the array argument to this short list. + * + * @param strings + * @return + */ + public StringList append(final short... items) + { + StringList result; + + if (items != null) + { + for (short item : items) + { + this.append(item); + } + } + + result = this; + + // + return result; + } + /** * Appends the string representation of the long argument to this string * list. @@ -303,6 +399,60 @@ public class StringList extends ArrayList implements CharSequence return result; } + /** + * Appends the string of the array argument to this boolean list. + * + * @param items + * @return + */ + public StringList appendln(final boolean... items) + { + StringList result; + + append(items).appendln(); + + result = this; + + // + return result; + } + + /** + * Appends the string of the array argument to this byte list. + * + * @param items + * @return + */ + public StringList appendln(final byte... items) + { + StringList result; + + append(items).appendln(); + + result = this; + + // + return result; + } + + /** + * Appends the string of the array argument to this char list. + * + * @param strings + * @return + */ + public StringList appendln(final char... items) + { + StringList result; + + append(items).appendln(); + + result = this; + + // + return result; + } + /** * Appends the string representation of the char argument to this string * list, then append a break line too. @@ -405,6 +555,24 @@ public class StringList extends ArrayList implements CharSequence return result; } + /** + * Appends the string of the array argument to this short list. + * + * @param strings + * @return + */ + public StringList appendln(final short... items) + { + StringList result; + + append(items).appendln(); + + result = this; + + // + return result; + } + /** * Appendln. *