Hoist constant byte[] out of loop
This commit is contained in:
committed by
Juergen Hoeller
parent
52630b06f5
commit
62ca7c4e8f
@@ -208,7 +208,7 @@ class ExtendedBeanInfo implements BeanInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String propertyNameFor(Method method) {
|
private String propertyNameFor(Method method) {
|
||||||
return Introspector.decapitalize(method.getName().substring(3, method.getName().length()));
|
return Introspector.decapitalize(method.getName().substring(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -534,11 +534,13 @@ class ExtendedBeanInfo implements BeanInfo {
|
|||||||
public int compare(PropertyDescriptor desc1, PropertyDescriptor desc2) {
|
public int compare(PropertyDescriptor desc1, PropertyDescriptor desc2) {
|
||||||
String left = desc1.getName();
|
String left = desc1.getName();
|
||||||
String right = desc2.getName();
|
String right = desc2.getName();
|
||||||
|
byte[] leftBytes = left.getBytes();
|
||||||
|
byte[] rightBytes = right.getBytes();
|
||||||
for (int i = 0; i < left.length(); i++) {
|
for (int i = 0; i < left.length(); i++) {
|
||||||
if (right.length() == i) {
|
if (right.length() == i) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
int result = left.getBytes()[i] - right.getBytes()[i];
|
int result = leftBytes[i] - rightBytes[i];
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user