mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
= code cleanup
- for loop replaceable with enhanced 'for' loop - using diamond in generic type - collapse try catch exception - using try-with-resource - using List#sort instead of Collections#sort - replaced lambda with method reference - using native compare method to compare numbers - using switch instead of if for in ESSyncUtil
This commit is contained in:
@@ -89,8 +89,8 @@ public class MysqlGTIDSet implements GTIDSet {
|
||||
// 存在多个GTID时会有回车符
|
||||
String[] uuidStrs = gtidData.replaceAll("\n", "").split(",");
|
||||
m = new HashMap<>(uuidStrs.length);
|
||||
for (int i = 0; i < uuidStrs.length; i++) {
|
||||
UUIDSet uuidSet = UUIDSet.parse(uuidStrs[i]);
|
||||
for (String uuidStr : uuidStrs) {
|
||||
UUIDSet uuidSet = UUIDSet.parse(uuidStr);
|
||||
m.put(uuidSet.SID.toString(), uuidSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class UUIDSet {
|
||||
if (equals(o)) {
|
||||
return 1;
|
||||
}
|
||||
return start > o.start ? 1 : (start == o.start ? 0 : -1);
|
||||
return Long.compare(start, o.start);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user