diff --git a/src/fr/devinsy/util/StringList.java b/src/fr/devinsy/util/StringList.java index e4bbc75..e663390 100755 --- a/src/fr/devinsy/util/StringList.java +++ b/src/fr/devinsy/util/StringList.java @@ -7,6 +7,7 @@ package fr.devinsy.util; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; /** * This class is a collection of String objects with specific methods. It makes @@ -45,6 +46,30 @@ public class StringList extends ArrayList implements CharSequence if (source != null) { + // + ensureCapacity(source.length); + + // + for (String string : source) + { + this.add(string); + } + } + } + + /** + * + */ + public StringList(final StringList source) + { + super(); + + if (source != null) + { + // + ensureCapacity(source.size()); + + // for (String string : source) { this.add(string); @@ -308,6 +333,28 @@ public class StringList extends ArrayList implements CharSequence return result; } + /** + * Deep copy and shallow copy have no sense about a list of immutable + * objects. + * + * @return + */ + @Override + public StringList clone() + { + StringList result; + + result = new StringList(size()); + + for (String string : this) + { + result.add(string); + } + + // + return result; + } + /** * */ @@ -413,6 +460,23 @@ public class StringList extends ArrayList implements CharSequence return (result); } + /** + * + * @return + */ + public StringList sort() + { + StringList result; + + Collections.sort(this); + + // + result = this; + + // + return result; + } + /** * */