mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 08:50:57 +07:00
16 lines
432 B
Java
16 lines
432 B
Java
// "Convert variable 'res' from String to StringBuilder (null-safe)" "true-preview"
|
|
|
|
class Main {
|
|
String test(String[] strings) {
|
|
StringBuilder res = null;
|
|
for (String s : strings) {
|
|
if(res == null) {
|
|
res = s == null ? null : new StringBuilder(s);
|
|
} else {
|
|
res.append(s);
|
|
}
|
|
}
|
|
return res == null ? null : res.toString();
|
|
}
|
|
}
|