From 433e405b7687e0a9dd839fcc5e576687bf05d770 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 22 Dec 2014 10:48:14 +0100 Subject: [PATCH] Add toStringArray methods. --- src/fr/devinsy/util/StringList.java | 41 ++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/fr/devinsy/util/StringList.java b/src/fr/devinsy/util/StringList.java index d28fcfe..de1b829 100755 --- a/src/fr/devinsy/util/StringList.java +++ b/src/fr/devinsy/util/StringList.java @@ -732,6 +732,25 @@ public class StringList extends ArrayList implements CharSequence return (result); } + /** + * + * @return + */ + public String[] toStringArray() + { + String[] result; + + result = new String[this.size()]; + + for (int index = 0; index < size(); index++) + { + result[index] = get(index); + } + + // + return result; + } + /** * */ @@ -826,7 +845,7 @@ public class StringList extends ArrayList implements CharSequence } /** - * + * This method converts a string array to a string. */ public static String toString(final String[] source) { @@ -845,6 +864,26 @@ public class StringList extends ArrayList implements CharSequence return (result); } + /** + * This method converts a StringList to an array of String. + */ + public static String[] toStringArray(final StringList source) + { + String[] result; + + if (source == null) + { + result = new String[0]; + } + else + { + result = source.toStringArray(); + } + + // + return (result); + } + /** * */