/** * Creates (mutable) string from given char array. */ public static String createString(char[] chars) { if (chars == null) { return null; } if (!SystemUtil.hasUnsafe()) { return new String(chars); } return PlatformInternal.unsafeCreateString(chars); }
/** * Returns String characters in most performing way. * If possible, the inner <code>char[]</code> will be returned. * If not, <code>toCharArray()</code> will be called. * Returns <code>null</code> when argument is <code>null</code>. */ public static char[] getChars(String string) { if (string == null) { return null; } if (!SystemUtil.hasUnsafe()) { return string.toCharArray(); } return PlatformInternal.unsafeGetChars(string); }