Optimized String.valueOf(char).

This commit is contained in:
jfrijters 2012-08-29 07:25:42 +00:00
Родитель 2f73fd3e14
Коммит f70ca066b6
2 изменённых файлов: 7 добавлений и 15 удалений

Просмотреть файл

@ -2486,19 +2486,6 @@ final class StringHelper
return b ? "true" : "false"; return b ? "true" : "false";
} }
/**
* Returns the string representation of the <code>char</code>
* argument.
*
* @param c a <code>char</code>.
* @return a string of length <code>1</code> containing
* as its single character the argument <code>c</code>.
*/
public static String valueOf(char c) {
char data[] = {c};
return new String(0, 1, data);
}
/** /**
* Returns the string representation of the <code>int</code> argument. * Returns the string representation of the <code>int</code> argument.
* <p> * <p>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<!-- <!--
Copyright (C) 2002-2011 Jeroen Frijters Copyright (C) 2002-2012 Jeroen Frijters
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -356,7 +356,12 @@
</method> </method>
<method name="valueOf" sig="(C)Ljava.lang.String;" modifiers="public static"> <method name="valueOf" sig="(C)Ljava.lang.String;" modifiers="public static">
<parameter name="c" /> <parameter name="c" />
<redirect class="java.lang.StringHelper" /> <body>
<ldarg_0 />
<ldc_i4_1 />
<newobj type="System.String" name=".ctor" sig="(CI)V" />
<ret />
</body>
</method> </method>
<method name="valueOf" sig="(F)Ljava.lang.String;" modifiers="public static"> <method name="valueOf" sig="(F)Ljava.lang.String;" modifiers="public static">
<parameter name="f" /> <parameter name="f" />