Simplified String2 constructor.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Tue, 21 Nov 2017 13:14:10 +0000 (15:14 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Tue, 21 Nov 2017 13:14:10 +0000 (15:14 +0200)
src/main/java/eu/svjatoslav/commons/string/String2.java

index 2e9446a..b6083ed 100755 (executable)
@@ -14,15 +14,10 @@ import java.util.List;
 
 public class String2 {
 
-    private final List<Character> chars;
+    private final List<Character> 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) {