diff --git a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java index 0d9db8e76..012a16d7b 100644 --- a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java @@ -251,15 +251,7 @@ public class CharSequenceUtils { * @return the resulting char array */ static char[] toCharArray(final CharSequence cs) { - if (cs instanceof String) { - return ((String) cs).toCharArray(); - } - final int sz = cs.length(); - final char[] array = new char[cs.length()]; - for (int i = 0; i < sz; i++) { - array[i] = cs.charAt(i); - } - return array; + return cs.toString().toCharArray(); } /**