From 13dfc691e5267a4625a7f31f041b6feeb8b073f7 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Tue, 21 Nov 2017 15:14:10 +0200 Subject: [PATCH] Simplified String2 constructor. --- src/main/java/eu/svjatoslav/commons/string/String2.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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) { -- 2.20.1