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
@@ -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);