[CELEBORN-1043] Convert variable ‘metric’ from String to StringBuilder in toMetric method
### What changes were proposed in this pull request? As Title ### Why are the changes needed? As Title ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? PASS GA Closes #1996 from jiaoqingbo/1043. Authored-by: jiaoqingbo <1178404354@qq.com> Signed-off-by: zky.zhoukeyong <zky.zhoukeyong@alibaba-inc.com>
This commit is contained in:
parent
9244cf2cf2
commit
efc36ebdba
@ -37,14 +37,14 @@ public enum DiskStatus {
|
||||
|
||||
public final String toMetric() {
|
||||
String[] fragments = this.name().split("_");
|
||||
String metric = "";
|
||||
StringBuilder metric = new StringBuilder();
|
||||
for (String fragment : fragments) {
|
||||
int len = fragment.length();
|
||||
if (len >= 1) {
|
||||
metric += fragment.substring(0, 1).toUpperCase();
|
||||
metric += fragment.substring(1, len).toLowerCase();
|
||||
metric.append(fragment.substring(0, 1).toUpperCase());
|
||||
metric.append(fragment.substring(1, len).toLowerCase());
|
||||
}
|
||||
}
|
||||
return metric;
|
||||
return metric.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user