From: Svjatoslav Agejenko Date: Tue, 21 Nov 2017 13:14:10 +0000 (+0200) Subject: Simplified String2 constructor. X-Git-Tag: svjatoslavcommons-1.8~43 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=13dfc691e5267a4625a7f31f041b6feeb8b073f7;p=svjatoslav_commons.git Simplified String2 constructor. --- diff --git a/src/main/java/eu/svjatoslav/commons/string/String2.java b/src/main/java/eu/svjatoslav/commons/string/String2.java index 2e9446a..b6083ed 100755 --- a/src/main/java/eu/svjatoslav/commons/string/String2.java +++ b/src/main/java/eu/svjatoslav/commons/string/String2.java @@ -14,15 +14,10 @@ import java.util.List; public class String2 { - private final List chars; + private final List chars = new ArrayList<>(); public String2(String value) { - if (value == null) - value = ""; - - chars = new ArrayList<>(value.length()); - for (final Character c : value.toCharArray()) - chars.add(c); + addSuffix(value); } public String2 addPrefix(final String prefix) {