Clean up single char indexOf()

This commit is contained in:
zzz
2016-12-02 18:52:37 +00:00
parent 5b31540fe8
commit 5be077e25d
29 changed files with 51 additions and 51 deletions

View File

@ -117,7 +117,7 @@ public class HostTxtEntry {
String[] entries = DataHelper.split(line, "#");
for (int i = 0; i < entries.length; i++) {
String kv = entries[i];
int eq = kv.indexOf("=");
int eq = kv.indexOf('=');
if (eq <= 0 || eq == kv.length() - 1)
throw new IllegalArgumentException("No value: \"" + kv + '"');
String k = kv.substring(0, eq);

View File

@ -190,7 +190,7 @@ public abstract class Addresses {
* @since IPv6
*/
private static String stripScope(String ip) {
int pct = ip.indexOf("%");
int pct = ip.indexOf('%');
if (pct > 0)
ip = ip.substring(0, pct);
return ip;

View File

@ -58,7 +58,7 @@ public class CommandLine {
protected static void exec(String args[], List<String> classes) {
String cmd = args[0].toLowerCase(Locale.US);
for (String cls : classes) {
String ccmd = cls.substring(cls.lastIndexOf(".") + 1).toLowerCase(Locale.US);
String ccmd = cls.substring(cls.lastIndexOf('.') + 1).toLowerCase(Locale.US);
if (cmd.equals(ccmd)) {
try {
String[] cargs = new String[args.length - 1];
@ -85,7 +85,7 @@ public class CommandLine {
System.err.println("Available commands:");
List<String> cmds = new ArrayList<String>(classes.size());
for (String cls : classes) {
String ccmd = cls.substring(cls.lastIndexOf(".") + 1).toLowerCase(Locale.US);
String ccmd = cls.substring(cls.lastIndexOf('.') + 1).toLowerCase(Locale.US);
cmds.add(ccmd);
}
Collections.sort(cmds);