Merge pull request #2860 from kubikrubikvkube/master

We should not create additional Strings in loop.
This commit is contained in:
ingmargoudt 2017-02-13 15:04:36 +01:00 committed by GitHub
commit 52af50f77e

View file

@ -58,17 +58,17 @@ public class MagePreferences {
}
public static String getUserNames() {
String userIds = "";
StringBuilder userIds = new StringBuilder();
try {
String[] keys = prefs().keys();
for (String key : keys) {
if (key.matches(".*userName$")) {
userIds += "," + prefs().get(key, null);
userIds.append(',').append(prefs().get(key, null));
}
}
} catch (BackingStoreException ex) {
}
return userIds;
return userIds.toString();
}
public static void setUserName(String serverAddress, String userName) {