Use String.indexOf(char) when checking for the index of a single character; it executes faster.

This commit is contained in:
wenshao
2012-08-29 15:52:17 +08:00
parent 11366696e5
commit fbbee2c651
3 changed files with 3 additions and 3 deletions
@@ -62,7 +62,7 @@ public class MapComparator<K extends Object, V extends Object> implements Compar
String keyStr = (String) key;
if (keyStr.matches(".+\\[[0-9]+\\]")) {
Object value = map.get(keyStr.substring(0, keyStr.indexOf("[")));
Object value = map.get(keyStr.substring(0, keyStr.indexOf('[')));
if (value == null) {
return null;
}