mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Use String.indexOf(char) when checking for the index of a single character; it executes faster.
This commit is contained in:
@@ -227,7 +227,7 @@ public class IPAddress implements Cloneable {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
// get the position of the first dot
|
||||
int index = tmp.indexOf(".");
|
||||
int index = tmp.indexOf('.');
|
||||
|
||||
// if there is not a dot then the ip string representation is
|
||||
// not compliant to the decimal-dotted notation.
|
||||
|
||||
@@ -198,7 +198,7 @@ public class IPRange {
|
||||
throw new IllegalArgumentException("Invalid IP range");
|
||||
}
|
||||
|
||||
int index = range.indexOf("/");
|
||||
int index = range.indexOf('/');
|
||||
String subnetStr = null;
|
||||
if (index == -1) {
|
||||
ipAddress = new IPAddress(range);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user