diff --git a/src/fr/devinsy/util/StringList.java b/src/fr/devinsy/util/StringList.java index e663390..dbce24f 100755 --- a/src/fr/devinsy/util/StringList.java +++ b/src/fr/devinsy/util/StringList.java @@ -368,6 +368,46 @@ public class StringList extends ArrayList implements CharSequence return (result); } + /** + * + */ + public String getFirst() + { + String result; + + if (this.size() == 0) + { + result = null; + } + else + { + result = get(0); + } + + // + return (result); + } + + /** + * + */ + public String getLast() + { + String result; + + if (this.size() == 0) + { + result = null; + } + else + { + result = get(this.size() - 1); + } + + // + return (result); + } + /** * * @param index @@ -460,6 +500,36 @@ public class StringList extends ArrayList implements CharSequence return (result); } + /** + * + */ + public StringList repeatLast(final int count) + { + StringList result; + + // + if ((this.size() != 0) && (count > 0)) + { + // + this.ensureCapacity(this.size() + count); + + // + String last = getLast(); + + // + for (int index = 0; index < count; index++) + { + this.append(last); + } + } + + // + result = this; + + // + return (result); + } + /** * * @return